/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = 'central';
  
  checkConfig(config);
  @endpoint = getEndpoint('smc', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model AssociateSourceServersRequest {
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  sourceId?: [ string ](name='SourceId', description='The IDs of migration sources. You can specify up to 50 IDs.

This parameter is required.'),
  workgroupId?: string(name='WorkgroupId', description='The ID of the workgroup.

This parameter is required.', example='w-***'),
}

model AssociateSourceServersResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='C8B26B44-0189-443E-9816-D951F59623A9'),
}

model AssociateSourceServersResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: AssociateSourceServersResponseBody(name='body'),
}

/**
 * @summary Associates multiple migration sources with a workgroup.
 *
 * @description A migration source can be associated with only one workgroup.
 *
 * @param request AssociateSourceServersRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return AssociateSourceServersResponse
 */
async function associateSourceServersWithOptions(request: AssociateSourceServersRequest, runtime: Util.RuntimeOptions): AssociateSourceServersResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.sourceId)) {
    query['SourceId'] = request.sourceId;
  }
  if (!Util.isUnset(request.workgroupId)) {
    query['WorkgroupId'] = request.workgroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'AssociateSourceServers',
    version = '2019-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Associates multiple migration sources with a workgroup.
 *
 * @description A migration source can be associated with only one workgroup.
 *
 * @param request AssociateSourceServersRequest
 * @return AssociateSourceServersResponse
 */
async function associateSourceServers(request: AssociateSourceServersRequest): AssociateSourceServersResponse {
  var runtime = new Util.RuntimeOptions{};
  return associateSourceServersWithOptions(request, runtime);
}

model CreateAccessTokenRequest {
  count?: string(name='Count', description='The maximum number of times that the activation code can be used to import the information of migration sources. Valid values: 1 to 1000.

Default value: 100.', example='10'),
  description?: string(name='Description', description='The description of the activation code.', example='The description of the activation code.'),
  name?: string(name='Name', description='The name of the activation code. The name must be 2 to 128 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain digits, colons (:), underscores (_), and hyphens (-).', example='test_name'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  timeToLiveInDays?: string(name='TimeToLiveInDays', description='The validity period of the activation code. The activation code can no longer be used to import the information of migration sources after the code expires. Unit: day. Valid values: 1 to 90.

Default value: 30.', example='30'),
}

model CreateAccessTokenResponseBody = {
  accessTokenCode?: string(name='AccessTokenCode', description='The value of the activation code. The value is returned only once after the CreateAccessToken operation is called and cannot be subsequently queried. Make sure that you properly save the returned value.', example='B57QoTXEA2Tytr0uZWoNY5Aju5Jt****'),
  accessTokenId?: string(name='AccessTokenId', description='The ID of the activation code.', example='at-bp1akz2zp67r0k6r****'),
  requestId?: string(name='RequestId', description='The request ID.', example='DB4A7EA2-6FDA-5655-B067-854532FB****'),
}

model CreateAccessTokenResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateAccessTokenResponseBody(name='body'),
}

/**
 * @summary Creates an activation code.
 *
 * @description If you want to import the information of migration sources by using an activation code, you can call this operation to create one.
 *
 * @param request CreateAccessTokenRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateAccessTokenResponse
 */
async function createAccessTokenWithOptions(request: CreateAccessTokenRequest, runtime: Util.RuntimeOptions): CreateAccessTokenResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.count)) {
    query['Count'] = request.count;
  }
  if (!Util.isUnset(request.description)) {
    query['Description'] = request.description;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.timeToLiveInDays)) {
    query['TimeToLiveInDays'] = request.timeToLiveInDays;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateAccessToken',
    version = '2019-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Creates an activation code.
 *
 * @description If you want to import the information of migration sources by using an activation code, you can call this operation to create one.
 *
 * @param request CreateAccessTokenRequest
 * @return CreateAccessTokenResponse
 */
async function createAccessToken(request: CreateAccessTokenRequest): CreateAccessTokenResponse {
  var runtime = new Util.RuntimeOptions{};
  return createAccessTokenWithOptions(request, runtime);
}

model CreateCrossZoneMigrationJobRequest {
  autoPay?: boolean(name='AutoPay', description='Specifies whether to enable automatic payment. Valid values:

*   **true** (default): enables automatic payment. Make sure that you have sufficient balance within your account.
*   **false**: disables automatic payment. In this case, you must manually pay for the instance. For more information, see [Renew a subscription instance](https://help.aliyun.com/document_detail/85052.html).', example='false'),
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotency of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length.', example='123e4567-e89b-12d3-a456-426655440000'),
  disk?: [ 
    {
      category?: string(name='Category', description='The disk category. A value of cloud_essd indicates enhanced SSD (ESSD).', example='cloud_essd'),
      diskId?: string(name='DiskId', description='The disk ID.', example='d-bp1eeplkn4j29wf7irpb'),
      performanceLevel?: string(name='PerformanceLevel', description='The performance level of the ESSD. Valid values:

*   PL0: A single ESSD can deliver up to 10,000 random read/write IOPS.
*   PL1: A single ESSD can deliver up to 50,000 random read/write IOPS.
*   PL2: A single ESSD can deliver up to 100,000 random read/write IOPS.
*   PL3: A single ESSD can deliver up to 1,000,000 random read/write IOPS.', example='PL0'),
    }
  ](name='Disk', description='The disk list.'),
  instanceId?: string(name='InstanceId', description='The instance ID.', example='i-bp1ff25rzvnul6kr****'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='The ID of the destination Alibaba Cloud region.

For example, if you want to migrate the source server to the China (Hangzhou) region, set this parameter to `cn-hangzhou`. You can call the [DescribeRegions](https://help.aliyun.com/document_detail/25609.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group.', example='rg-acfmw3ty5y7****'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  targetInstanceType?: string(name='TargetInstanceType', description='The type of the new instance.', example='ecs.g7.large'),
  targetVSwitchId?: string(name='TargetVSwitchId', description='The vSwitch ID of the destination Elastic Compute Service (ECS) instance.', example='vsw-bp1mxqnssl8nafltcx32e'),
  targetZoneId?: string(name='TargetZoneId', description='The ID of the destination zone.', example='cn-hangzhou-i'),
}

model CreateCrossZoneMigrationJobResponseBody = {
  jobId?: string(name='JobId', description='The ID of the migration job.', example='j-bp17bclvg344jlyt****'),
  requestId?: string(name='RequestId', description='The request ID.', example='A9DBD2F8-DE5A-5844-BA6F-957A996CBD78'),
}

model CreateCrossZoneMigrationJobResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateCrossZoneMigrationJobResponseBody(name='body'),
}

/**
 * @summary Server Migration Center (SMC) allows you to migrate Alibaba Cloud ECS instances across zones in the same region. You can also change the instance type (vCPU and memory) within the same instance family to meet your business requirements. You can use this API to create a cross-zone migration job.
 *
 * @description For more information about the limits and impacts of cross-zone migration, see [Cross-zone ECS instance migration](https://help.aliyun.com/document_detail/476797.html).
 *
 * @param request CreateCrossZoneMigrationJobRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateCrossZoneMigrationJobResponse
 */
async function createCrossZoneMigrationJobWithOptions(request: CreateCrossZoneMigrationJobRequest, runtime: Util.RuntimeOptions): CreateCrossZoneMigrationJobResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.autoPay)) {
    query['AutoPay'] = request.autoPay;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.disk)) {
    query['Disk'] = request.disk;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.targetInstanceType)) {
    query['TargetInstanceType'] = request.targetInstanceType;
  }
  if (!Util.isUnset(request.targetVSwitchId)) {
    query['TargetVSwitchId'] = request.targetVSwitchId;
  }
  if (!Util.isUnset(request.targetZoneId)) {
    query['TargetZoneId'] = request.targetZoneId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateCrossZoneMigrationJob',
    version = '2019-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Server Migration Center (SMC) allows you to migrate Alibaba Cloud ECS instances across zones in the same region. You can also change the instance type (vCPU and memory) within the same instance family to meet your business requirements. You can use this API to create a cross-zone migration job.
 *
 * @description For more information about the limits and impacts of cross-zone migration, see [Cross-zone ECS instance migration](https://help.aliyun.com/document_detail/476797.html).
 *
 * @param request CreateCrossZoneMigrationJobRequest
 * @return CreateCrossZoneMigrationJobResponse
 */
async function createCrossZoneMigrationJob(request: CreateCrossZoneMigrationJobRequest): CreateCrossZoneMigrationJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return createCrossZoneMigrationJobWithOptions(request, runtime);
}

model CreateReplicationJobRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  containerNamespace?: string(name='ContainerNamespace', description='The namespace of the destination Docker container image. For more information about Docker container images, see [Terms](https://help.aliyun.com/document_detail/60744.html).', example='testNamespace'),
  containerRepository?: string(name='ContainerRepository', description='The repository that stores the destination Docker container image. For more information about Docker container images, see [Terms](https://help.aliyun.com/document_detail/60744.html).', example='testRepository'),
  containerTag?: string(name='ContainerTag', description='The tag of the destination Docker container image. For more information about Docker container images, see [Terms](https://help.aliyun.com/document_detail/60744.html).', example='CentOS:v1'),
  dataDisk?: [ 
    {
      index?: int32(name='Index', description='The index of data disk N on the destination ECS instance. Data disks on a destination ECS instance are arranged in a sequential order that starts from 1. Valid values: 1 to 16.

>  To create a destination data disk for a source server, make sure that the source server has data disks.', example='1'),
      part?: [ 
        {
          block?: boolean(name='Block', description='Specifies whether to enable block replication for partition N in the destination data disk. Valid values:

*   true
*   false

Default value: true', example='true'),
          device?: string(name='Device', description='The device ID of partition N in the destination data disk. The partitions in the destination data disk are arranged in the same sequential order as those in the source data disk.

>  You must set both the DataDisk.N.Part.N.Device and `DataDisk.N.Part.N.SizeBytes` parameters or leave both parameters empty.', example='0_1'),
          sizeBytes?: long(name='SizeBytes', description='The size of partition N in the destination data disk. Unit: bytes. The default value is equal to the corresponding partition size of the source data disk.

> 

*   The total size of all partitions in a destination data disk cannot exceed the size of the destination data disk.

*   You must set both the `DataDisk.N.Part.N.Device` and DataDisk.N.Part.N.SizeBytes parameters or leave both parameters empty.', example='254803968'),
        }
      ](name='Part', description='The data disk partitions.'),
      size?: int32(name='Size', description='The size of the data disk on the destination ECS instance. Unit: GiB. Valid values: 20 to 32768.

>  The size of a destination data disk must be larger than the size of data in the source data disk. For example, if the size of the source data disk is 500 GiB and the used space is 100 GiB, you must set this parameter to a value greater than 100.', example='100'),
    }
  ](name='DataDisk', description='The data disks.'),
  description?: string(name='Description', description='The description of the migration job.

The description must be 2 to 128 characters in length, and can contain digits, colons (:), underscores (_), and hyphens (-). The description must start with a letter, but cannot start with `http://` or `https://`.', example='This_is_a_migration_task'),
  disks?: {
    data?: [ 
      {
        diskId?: string(name='DiskId', description='The ID of the data disk.', example='d-2ze8hyowhdgd6ou2m5z6'),
        LVM?: boolean(name='LVM', description='Specifies whether the data disk uses LVM. Valid values:

*   true: Use LVM.
*   false: Not use LVM.'),
        part?: [ 
          {
            block?: boolean(name='Block', description='Whether block replication is enabled for the data disk partition. Valid values:

*   true: Block replication is enabled for the data disk partition.
*   false: Block replication is disabled for the data disk partition.', example='true'),
            path?: string(name='Path', description='The path of the data disk partition.', example='/home/date'),
            sizeBytes?: long(name='SizeBytes', description='The size of the data disk partition. Unit: bytes.', example='21474836480'),
          }
        ](name='Part', description='The information about the data disk partition.'),
        size?: int32(name='Size', description='The size of the data disk of the migration source. Unit: GiB.', example='80'),
      }
    ](name='Data', description='The information about the data disk partition.'),
    system?: {
      LVM?: boolean(name='LVM', description='Specifies whether to use LVM. Valid values:

*   true: Use LVM.
*   false: Not use LVM.

LVM is not supported:

*   If your source server runs Windows, LVM is not supported.
*   The system disk does not have a boot partition, and LVM is not supported.

After LVM is enabled, this feature does not take effect in the following scenarios:

*   LVM2 is not supported on your source server and the software package is not installed.
*   Your source server runs Debian with a kernel version of 3.x or earlier and XFS file systems are mounted.', example='true'),
      part?: [ 
        {
          block?: boolean(name='Block', description='Specifies whether block replication is enabled for the system disk partition.', example='true'),
          path?: string(name='Path', description='The path of the system disk partition.', example='/boot'),
          sizeBytes?: long(name='SizeBytes', description='The size of the system disk partition. Unit: bytes.', example='254803968'),
        }
      ](name='Part', description='The information about the system disk partition.'),
      size?: int32(name='Size', description='The size of the source system disk. Unit: GiB. Valid values: 20 to 32768.

>  The parameter value must be greater than the actual used space of the data disk on the source server. For example, if the size of the source disk is 500 GiB but the actual used space is 100 GiB, you must set this parameter to a value greater than 100 GiB.', example='100'),
    }(name='System', description='The information about the system disk.'),
  }(name='Disks', description='The information about the disk.'),
  frequency?: int32(name='Frequency', description='The interval at which SMC synchronizes incremental data to Alibaba Cloud. Unit: hour. Valid values: 1 to 168.

This parameter is required if you set the `RunOnce` parameter to false.

By default, this parameter is empty.', example='12'),
  imageName?: string(name='ImageName', description='The name of the destination image. The name must meet the following requirements:

*   The name must be unique within an Alibaba Cloud region.
*   The name must be 2 to 128 characters in length, and can contain digits, colons (:), underscores (_), and hyphens (-). The name must start with a letter, but cannot start with `http://` or `https://`.

>  If you specify an image name that already exists in the destination region, the migration job ID is appended to the image name as a suffix. Example: ImageName_j-2zexxxxxxxxxxxxx.', example='testAliCloudImageName'),
  instanceId?: string(name='InstanceId', description='The ID of the destination ECS instance.', example='i-bp1f1dvfto1sigz5****'),
  instanceRamRole?: string(name='InstanceRamRole', description='The name of the Resource Access Management (RAM) role that is assigned to the instance.', example='SMCAdmin'),
  instanceType?: string(name='InstanceType', description='The type of the intermediate instance.

You can call the [DescribeInstanceTypes](https://help.aliyun.com/document_detail/25620.html) operation to obtain the ECS instance types.

*   If you specify this parameter, SMC creates an intermediate instance of the specified instance type. If the specified instance type is unavailable, you cannot create the migration job.
*   If you do not specify this parameter, SMC selects an available instance type in a specific order to create an intermediate instance. For more information, see [SMC FAQ](https://help.aliyun.com/document_detail/121707.html).', example='ecs.c6.large'),
  jobType?: int32(name='JobType', description='The type of the migration job. Valid values:

*   0: server migration.
*   1: operating system migration.
*   2: cross-zone migration.
*   3: agentless migration for a VMware VM.', example='0'),
  launchTemplateId?: string(name='LaunchTemplateId', description='The ID of the launch template.', example='lt-bp16jovvln1cgaaq****'),
  launchTemplateVersion?: string(name='LaunchTemplateVersion', description='The version number of the launch template.', example='1'),
  licenseType?: string(name='LicenseType', description='The license type. Valid values:

*   An empty value specifies no license.
*   A value of BYOL specifies Bring Your Own License (BYOL).

For more information, see [SMC FAQ](https://help.aliyun.com/document_detail/121707.html).', example='BYOL'),
  maxNumberOfImageToKeep?: int32(name='MaxNumberOfImageToKeep', description='The maximum number of images retained for the incremental migration job. Valid values: 1 to 10.

This parameter is required if you set the `RunOnce` parameter to false.

By default, this parameter is empty.', example='10'),
  name?: string(name='Name', description='The name of the migration job. The name must meet the following requirements:

*   The name must be unique.
*   The name must be 2 to 128 characters in length, and can contain digits, colons (:), underscores (_), and hyphens (-). The name must start with a letter, but cannot start with `http://` or `https://`.', example='testMigrationTaskName'),
  netMode?: int32(name='NetMode', description='The network mode for data transmission. Valid values:

*   0: Data is transmitted over the Internet. Make sure that the source server can access the Internet.
*   2: Data is transmitted over a VPC. If you specify this value, you must specify the VSwitchId parameter. You do not need to specify the VpcId parameter because the value of the VpcId parameter can be retrieved based on the value of the VSwitchId parameter.

Default value: 0', example='0'),
  ownerId?: long(name='OwnerId'),
  regionId?: string(name='RegionId', description='The ID of the Alibaba Cloud region to which you want to migrate the source server.

For example, if you want to migrate the source server to the China (Hangzhou) region, set this parameter to `cn-hangzhou`. You can call the [DescribeRegions](https://help.aliyun.com/document_detail/25609.html) operation to query the latest regions.

This parameter is required.', example='cn-hangzhou'),
  replicationParameters?: string(name='ReplicationParameters', description='The parameters of the replication driver. The parameters must be specified as key-value pairs in the JSON format. The keys are fixed for each type of replication driver. The JSON string can be up to 2,048 characters in length.

A replication driver is a tool that is used to migrate a source server to an intermediate instance. The parameters vary based on the replication driver type. If you use a Server Migration Tool (SMT) driver, you can specify the following parameters:

*   bandwidth_limit: the maximum bandwidth for data transmission.
*   compress_level: the compression ratio of data to be transmitted.
*   checksum: specifies whether to enable checksum verification.

For more information about replication drivers, see the response parameter `SourceServers.ReplicationDriver` of the [DescribeSourceServers](https://help.aliyun.com/document_detail/121818.html) operation.', example='{"bandwidth_limit":0,"compress_level":1,"checksum":true}'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group.', example='rg-acfmw3ty5y7****'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  runOnce?: boolean(name='RunOnce', description='Specifies whether to disable incremental migration for the source server. Valid values:

*   true: creates a migration job that runs only once. This is the default value. Incremental data of the source server is not synchronized.
*   false: creates an incremental migration job. In this case, you must specify the `Frequency` parameter. SMC synchronizes incremental data of the source server to Alibaba Cloud at the specified frequency. You can use an incremental migration job to synchronize incremental data from the source server to Alibaba Cloud without the need to interrupt your business. A full data image is generated for the source server when the job is running.

>  You can specify this parameter only when you create a migration job. The parameter value cannot be changed after the migration job is created.', example='true'),
  scheduledStartTime?: string(name='ScheduledStartTime', description='The time when you want to run the migration job. The time must meet the following requirements:

*   The time must be specified in the ISO 8601 standard in the YYYY-MM-DDThh:mm:ssZ format. For example, 2018-01-01T12:00:00Z specifies 20:00:00 on January 1, 2018 (UTC+8).
*   The value must be within 30 days after the current time.

>  If you do not specify this parameter, you must manually start the migration job after the job is created. You can call the [StartReplicationJob](https://help.aliyun.com/document_detail/121823.html) operation to start the migration job.', example='2019-06-04T13:35:00Z'),
  sourceId?: string(name='SourceId', description='The ID of the source server.

This parameter is required.', example='s-bp1e2fsl57knvuug****'),
  systemDiskPart?: [ 
    {
      block?: boolean(name='Block', description='Specifies whether to enable block replication for partition N in the destination system disk. Valid values:

*   true
*   false

Default value: true', example='true'),
      device?: string(name='Device', description='The ID of partition N in the destination system disk. The partitions in the destination system disk are arranged in the same sequential order as those in the source system disk.

>  You must set both the SystemDiskPart.N.Device and `SystemDiskPart.N.SizeBytes` parameters or leave both parameters empty.', example='0_1'),
      sizeBytes?: long(name='SizeBytes', description='The size of the partition N in the destination system disk. Unit: bytes. The default value is equal to the partition size of the source system disk.

> 

*   The total size of all partitions in the destination system disk cannot exceed the size of the destination system disk.

*   You must set both the `SystemDiskPart.N.Device` and SystemDiskPart.N.SizeBytes parameters or leave both parameters empty.', example='254803968'),
    }
  ](name='SystemDiskPart', description='The information about system disk partitions.'),
  systemDiskSize?: int32(name='SystemDiskSize', description='The system disk size of the destination ECS instance. Unit: GiB. Valid values: 20 to 2048.

>  The value must be greater than the used space of the system disk on the source server. For example, if the total size of the source disk is 500 GiB and the used space is 100 GiB, the value of this parameter must be greater than 100 GiB.', example='80'),
  tag?: [ 
    {
      key?: string(name='Key', description='The key of the tag for the migration job. Valid values of N: 1 to 20.

The tag key cannot be an empty string. The tag key can be up to 128 characters in length and cannot start with `aliyun`, `acs:`, `http://`, or `https://`.', example='TestKey'),
      value?: string(name='Value', description='The value of the tag for the migration job. Valid values of N: 1 to 20.

The tag value can be an empty string. The tag value can be up to 128 characters in length and cannot start with `aliyun`, `acs:`, `http://`, or `https://`.', example='TestValue'),
    }
  ](name='Tag', description='The tags.'),
  targetType?: string(name='TargetType', description='The type of destination to which you want to migrate the source server. Valid values:

*   Image: After the migration job is complete, SMC generates an Elastic Compute Service (ECS) image for the source server.
*   ContainerImage: After the migration job is complete, SMC generates a Docker container image for the source server.
*   TargetInstance: After the migration job is completed, SMC migrates the source server to the destination instance. If you set this parameter to TargetInstance, you must set the `InstanceId` parameter.', example='Image'),
  vSwitchId?: string(name='VSwitchId', description='The ID of the vSwitch in the specified VPC.

You must set this parameter if you use a VPC to migrate data.', example='vsw-bp1ddbrxdlrcbim46****'),
  validTime?: string(name='ValidTime', description='The time when the migration job expires. You can schedule the migration job to expire 7 to 90 days after the job is created.

*   The time must be specified in the ISO 8601 standard in the YYYY-MM-DDThh:mm:ssZ format. For example, 2018-01-01T12:00:00Z specifies 20:00:00 on January 1, 2018 (UTC+8).
*   If you do not specify this parameter, the migration job does not expire.
*   After a migration job expires, the job state changes to Expired. SMC retains the migration job for seven days after the job expires. After the job is retained for seven days, SMC deletes the migration job.

By default, a migration job is valid for 30 days after it is created.', example='2019-06-04T13:35:00Z'),
  vpcId?: string(name='VpcId', description='The ID of a VPC for which you have configured an Express Connect circuit or a VPN gateway.', example='vpc-bp1vwnn14rqpyiczj****'),
}

model CreateReplicationJobResponseBody = {
  jobId?: string(name='JobId', description='The ID of the migration job.', example='j-bp17bclvg344jlyt****'),
  requestId?: string(name='RequestId', description='The request ID.', example='C8B26B44-0189-443E-9816-D951F59623A9'),
}

model CreateReplicationJobResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateReplicationJobResponseBody(name='body'),
}

/**
 * @summary Creates a migration job for a source server.
 *
 * @description ## Usage notes
 * *   You can create migration jobs only for source servers that are in the Available state.
 * *   Each source server can be associated with only one migration job that is in the Ready, Running, Stopped, Waiting, InError, or Expired state.
 * *   You can create a maximum of 1,000 migration jobs within each Alibaba Cloud account.
 * *   If you migrate a source server to an image, you must specify the ImageName, SystemDiskSize, and DataDisk parameters.
 * *   If you use a virtual private cloud (VPC) to migrate data, the VSwitchId parameter is required and the VpcId parameter is optional.
 * *   Server Migration Center (SMC) allows you to migrate source servers to Docker container images. This allows you to migrate containerized applications in a cost-effective way.
 *
 * @param request CreateReplicationJobRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateReplicationJobResponse
 */
async function createReplicationJobWithOptions(request: CreateReplicationJobRequest, runtime: Util.RuntimeOptions): CreateReplicationJobResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.containerNamespace)) {
    query['ContainerNamespace'] = request.containerNamespace;
  }
  if (!Util.isUnset(request.containerRepository)) {
    query['ContainerRepository'] = request.containerRepository;
  }
  if (!Util.isUnset(request.containerTag)) {
    query['ContainerTag'] = request.containerTag;
  }
  if (!Util.isUnset(request.dataDisk)) {
    query['DataDisk'] = request.dataDisk;
  }
  if (!Util.isUnset(request.description)) {
    query['Description'] = request.description;
  }
  if (!Util.isUnset(request.disks)) {
    query['Disks'] = request.disks;
  }
  if (!Util.isUnset(request.frequency)) {
    query['Frequency'] = request.frequency;
  }
  if (!Util.isUnset(request.imageName)) {
    query['ImageName'] = request.imageName;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.instanceRamRole)) {
    query['InstanceRamRole'] = request.instanceRamRole;
  }
  if (!Util.isUnset(request.instanceType)) {
    query['InstanceType'] = request.instanceType;
  }
  if (!Util.isUnset(request.jobType)) {
    query['JobType'] = request.jobType;
  }
  if (!Util.isUnset(request.launchTemplateId)) {
    query['LaunchTemplateId'] = request.launchTemplateId;
  }
  if (!Util.isUnset(request.launchTemplateVersion)) {
    query['LaunchTemplateVersion'] = request.launchTemplateVersion;
  }
  if (!Util.isUnset(request.licenseType)) {
    query['LicenseType'] = request.licenseType;
  }
  if (!Util.isUnset(request.maxNumberOfImageToKeep)) {
    query['MaxNumberOfImageToKeep'] = request.maxNumberOfImageToKeep;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.netMode)) {
    query['NetMode'] = request.netMode;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.replicationParameters)) {
    query['ReplicationParameters'] = request.replicationParameters;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.runOnce)) {
    query['RunOnce'] = request.runOnce;
  }
  if (!Util.isUnset(request.scheduledStartTime)) {
    query['ScheduledStartTime'] = request.scheduledStartTime;
  }
  if (!Util.isUnset(request.sourceId)) {
    query['SourceId'] = request.sourceId;
  }
  if (!Util.isUnset(request.systemDiskPart)) {
    query['SystemDiskPart'] = request.systemDiskPart;
  }
  if (!Util.isUnset(request.systemDiskSize)) {
    query['SystemDiskSize'] = request.systemDiskSize;
  }
  if (!Util.isUnset(request.tag)) {
    query['Tag'] = request.tag;
  }
  if (!Util.isUnset(request.targetType)) {
    query['TargetType'] = request.targetType;
  }
  if (!Util.isUnset(request.vSwitchId)) {
    query['VSwitchId'] = request.vSwitchId;
  }
  if (!Util.isUnset(request.validTime)) {
    query['ValidTime'] = request.validTime;
  }
  if (!Util.isUnset(request.vpcId)) {
    query['VpcId'] = request.vpcId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateReplicationJob',
    version = '2019-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Creates a migration job for a source server.
 *
 * @description ## Usage notes
 * *   You can create migration jobs only for source servers that are in the Available state.
 * *   Each source server can be associated with only one migration job that is in the Ready, Running, Stopped, Waiting, InError, or Expired state.
 * *   You can create a maximum of 1,000 migration jobs within each Alibaba Cloud account.
 * *   If you migrate a source server to an image, you must specify the ImageName, SystemDiskSize, and DataDisk parameters.
 * *   If you use a virtual private cloud (VPC) to migrate data, the VSwitchId parameter is required and the VpcId parameter is optional.
 * *   Server Migration Center (SMC) allows you to migrate source servers to Docker container images. This allows you to migrate containerized applications in a cost-effective way.
 *
 * @param request CreateReplicationJobRequest
 * @return CreateReplicationJobResponse
 */
async function createReplicationJob(request: CreateReplicationJobRequest): CreateReplicationJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return createReplicationJobWithOptions(request, runtime);
}

model CreateWorkgroupRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  description?: string(name='Description', description='The description of the workgroup.

The description must be 2 to 128 characters in length. It must start with a letter and cannot start with `http://` or `https://`. It can contain letters, digits, colons (:), underscores (_), and hyphens (-).', example='test'),
  name?: string(name='Name', description='The name of the workgroup. The name must meet the following requirements:

*   The name must be unique.
*   The name must be 2 to 128 characters in length. It must start with a letter and cannot start with `http://` or `https://`. It can contain letters, digits, colons (:), underscores (_), and hyphens (-).', example='testWorkgroupName'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  tag?: [ 
    {
      key?: string(name='Key', description='The tag key of a specified workgroup.

You can specify an empty string as a tag key. The tag key can be up to 64 characters in length and cannot contain http:// or https://.', example='TestKey'),
      value?: string(name='Value', description='The tag value of a specified workgroup.

You can specify an empty string as a tag value. The tag value can be up to 64 characters in length and cannot contain http:// or https://.', example='TestValue'),
    }
  ](name='Tag', description='The tag information of the workgroup.'),
}

model CreateWorkgroupResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='C8B26B44-0189-443E-9816-D951F59623A9'),
  workgroupId?: string(name='WorkgroupId', description='The workgroup ID.', example='w-***'),
}

model CreateWorkgroupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateWorkgroupResponseBody(name='body'),
}

/**
 * @summary Creates a workgroup. You can create a workgroup to manage the lifecycles of multiple migration tasks at a time. This is suitable for scenarios in which multiple servers are migrated.
 *
 * @description *   You can create up to 50 workgroups within an Alibaba Cloud account.
 * *   A workgroup can be associated with a maximum of 50 migration sources.
 * *   A migration source can be associated with only one workgroup.
 *
 * @param request CreateWorkgroupRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateWorkgroupResponse
 */
async function createWorkgroupWithOptions(request: CreateWorkgroupRequest, runtime: Util.RuntimeOptions): CreateWorkgroupResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.description)) {
    query['Description'] = request.description;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.tag)) {
    query['Tag'] = request.tag;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateWorkgroup',
    version = '2019-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Creates a workgroup. You can create a workgroup to manage the lifecycles of multiple migration tasks at a time. This is suitable for scenarios in which multiple servers are migrated.
 *
 * @description *   You can create up to 50 workgroups within an Alibaba Cloud account.
 * *   A workgroup can be associated with a maximum of 50 migration sources.
 * *   A migration source can be associated with only one workgroup.
 *
 * @param request CreateWorkgroupRequest
 * @return CreateWorkgroupResponse
 */
async function createWorkgroup(request: CreateWorkgroupRequest): CreateWorkgroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return createWorkgroupWithOptions(request, runtime);
}

model CutOverReplicationJobRequest {
  jobId?: string(name='JobId', description='The ID of the incremental migration job.

This parameter is required.', example='j-bp1fnx5y3djc4cop****'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  syncData?: boolean(name='SyncData', description='Specifies whether to migrate full data for the last time. Valid Values:

*   true: migrates full data for the last time.
*   false: does not migrate full data for the last time.

Default value: false.', example='false'),
}

model CutOverReplicationJobResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E'),
}

model CutOverReplicationJobResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CutOverReplicationJobResponseBody(name='body'),
}

/**
 * @summary Stops an incremental migration job that periodically runs. After you call this operation to stop an incremental migration job, the migration job is complete.
 *
 * @description ## Usage notes
 * *   The incremental migration job must be in the Waiting state.
 * *   After you call this operation, the incremental migration job no longer periodically runs. In the meantime, Server Migration Center (SMC) determines whether to perform a full data migration for the last time based on the value of the `SyncData` parameter. If you set the SyncData parameter to `false`, SMC releases intermediate resources without data migration before the migration job is complete. If you set the SyncData parameter to `true`, SMC performs a full data migration and releases intermediate resources before the migration job is complete.
 *
 * @param request CutOverReplicationJobRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CutOverReplicationJobResponse
 */
async function cutOverReplicationJobWithOptions(request: CutOverReplicationJobRequest, runtime: Util.RuntimeOptions): CutOverReplicationJobResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.jobId)) {
    query['JobId'] = request.jobId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.syncData)) {
    query['SyncData'] = request.syncData;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CutOverReplicationJob',
    version = '2019-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Stops an incremental migration job that periodically runs. After you call this operation to stop an incremental migration job, the migration job is complete.
 *
 * @description ## Usage notes
 * *   The incremental migration job must be in the Waiting state.
 * *   After you call this operation, the incremental migration job no longer periodically runs. In the meantime, Server Migration Center (SMC) determines whether to perform a full data migration for the last time based on the value of the `SyncData` parameter. If you set the SyncData parameter to `false`, SMC releases intermediate resources without data migration before the migration job is complete. If you set the SyncData parameter to `true`, SMC performs a full data migration and releases intermediate resources before the migration job is complete.
 *
 * @param request CutOverReplicationJobRequest
 * @return CutOverReplicationJobResponse
 */
async function cutOverReplicationJob(request: CutOverReplicationJobRequest): CutOverReplicationJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return cutOverReplicationJobWithOptions(request, runtime);
}

model DeleteAccessTokenRequest {
  accessTokenId?: string(name='AccessTokenId', description='The ID of the activation code.

This parameter is required.', example='at-bp1akz2zp67r0k6r****'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
}

model DeleteAccessTokenResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='DB4A7EA2-6FDA-5655-B067-854532FB****'),
}

model DeleteAccessTokenResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteAccessTokenResponseBody(name='body'),
}

/**
 * @summary Deletes an activation code.
 *
 * @description You can call this operation to delete an activation code if you no longer need to import the information about migration sources by using the activation code or if the activation code has expired.
 *
 * @param request DeleteAccessTokenRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteAccessTokenResponse
 */
async function deleteAccessTokenWithOptions(request: DeleteAccessTokenRequest, runtime: Util.RuntimeOptions): DeleteAccessTokenResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accessTokenId)) {
    query['AccessTokenId'] = request.accessTokenId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteAccessToken',
    version = '2019-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Deletes an activation code.
 *
 * @description You can call this operation to delete an activation code if you no longer need to import the information about migration sources by using the activation code or if the activation code has expired.
 *
 * @param request DeleteAccessTokenRequest
 * @return DeleteAccessTokenResponse
 */
async function deleteAccessToken(request: DeleteAccessTokenRequest): DeleteAccessTokenResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteAccessTokenWithOptions(request, runtime);
}

model DeleteReplicationJobRequest {
  jobId?: string(name='JobId', description='The migration job ID.

This parameter is required.', example='j-bp17m1vi6x21qhqk****'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
}

model DeleteReplicationJobResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E'),
}

model DeleteReplicationJobResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteReplicationJobResponseBody(name='body'),
}

/**
 * @summary Deletes a migration job.
 *
 * @description ## Usage notes
 * *   Deleted migration jobs cannot be restored.
 * *   After a migration job is deleted, associated resources, such as the intermediate instance, are automatically released.
 *
 * @param request DeleteReplicationJobRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteReplicationJobResponse
 */
async function deleteReplicationJobWithOptions(request: DeleteReplicationJobRequest, runtime: Util.RuntimeOptions): DeleteReplicationJobResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.jobId)) {
    query['JobId'] = request.jobId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteReplicationJob',
    version = '2019-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Deletes a migration job.
 *
 * @description ## Usage notes
 * *   Deleted migration jobs cannot be restored.
 * *   After a migration job is deleted, associated resources, such as the intermediate instance, are automatically released.
 *
 * @param request DeleteReplicationJobRequest
 * @return DeleteReplicationJobResponse
 */
async function deleteReplicationJob(request: DeleteReplicationJobRequest): DeleteReplicationJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteReplicationJobWithOptions(request, runtime);
}

model DeleteSourceServerRequest {
  force?: boolean(name='Force', description='Specifies whether to forcibly delete the migration source. Valid values:

*   true: forcibly deletes the migration source and the migration job created for the migration source, and releases the intermediate resources of the migration job.
*   false: does not delete the migration source if a migration job is created for the migration source.', example='true'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  sourceId?: string(name='SourceId', description='The migration source ID.

This parameter is required.', example='s-bp17m1vi6x20c6g6****'),
}

model DeleteSourceServerResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E'),
}

model DeleteSourceServerResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteSourceServerResponseBody(name='body'),
}

/**
 * @summary Deletes a migration source.
 *
 * @description ## Usage notes
 * *   If a migration job is created for the migration source and the migration job is in the Running state, the migration source cannot be deleted.
 * *   If a migration job is created for the migration source but the migration job is not in the Running state, you can set the `Force` parameter to true to delete the migration source.
 *
 * @param request DeleteSourceServerRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteSourceServerResponse
 */
async function deleteSourceServerWithOptions(request: DeleteSourceServerRequest, runtime: Util.RuntimeOptions): DeleteSourceServerResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.force)) {
    query['Force'] = request.force;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.sourceId)) {
    query['SourceId'] = request.sourceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteSourceServer',
    version = '2019-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Deletes a migration source.
 *
 * @description ## Usage notes
 * *   If a migration job is created for the migration source and the migration job is in the Running state, the migration source cannot be deleted.
 * *   If a migration job is created for the migration source but the migration job is not in the Running state, you can set the `Force` parameter to true to delete the migration source.
 *
 * @param request DeleteSourceServerRequest
 * @return DeleteSourceServerResponse
 */
async function deleteSourceServer(request: DeleteSourceServerRequest): DeleteSourceServerResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteSourceServerWithOptions(request, runtime);
}

model DeleteWorkgroupRequest {
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  workgroupId?: string(name='WorkgroupId', description='The workgroup ID.

This parameter is required.', example='w-***'),
}

model DeleteWorkgroupResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='410E6073-66D0-45D3-AB3E-4DC3F5E4****'),
}

model DeleteWorkgroupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteWorkgroupResponseBody(name='body'),
}

/**
 * @summary Deletes a workgroup.
 *
 * @description To delete a workgroup, you must delete or dissociate the migration source that is associated with the workgroup. For more information, see [DeleteSourceServer](https://help.aliyun.com/document_detail/2402124.html).
 *
 * @param request DeleteWorkgroupRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteWorkgroupResponse
 */
async function deleteWorkgroupWithOptions(request: DeleteWorkgroupRequest, runtime: Util.RuntimeOptions): DeleteWorkgroupResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.workgroupId)) {
    query['WorkgroupId'] = request.workgroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteWorkgroup',
    version = '2019-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Deletes a workgroup.
 *
 * @description To delete a workgroup, you must delete or dissociate the migration source that is associated with the workgroup. For more information, see [DeleteSourceServer](https://help.aliyun.com/document_detail/2402124.html).
 *
 * @param request DeleteWorkgroupRequest
 * @return DeleteWorkgroupResponse
 */
async function deleteWorkgroup(request: DeleteWorkgroupRequest): DeleteWorkgroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteWorkgroupWithOptions(request, runtime);
}

model DescribeReplicationJobsRequest {
  businessStatus?: string(name='BusinessStatus', description='The business status of the migration job. Valid values:

*   Preparing: The migration is being prepared.
*   Syncing: Data is being synchronized.
*   Processing: The migration is in progress.
*   Cleaning: Intermediate resources are being released.', example='Preparing'),
  instanceId?: [ string ](name='InstanceId', description='The IDs of the destination Elastic Compute Service (ECS) instances.'),
  jobId?: [ string ](name='JobId', description='The IDs of the migration jobs. You can specify a maximum of 50 IDs.', example='j-bp19vlwm0tyigbmj****'),
  jobType?: int32(name='JobType', description='The type of the migration job. Valid values:

*   0: server migration.
*   1: operating system migration.
*   2: cross-zone migration.
*   3: agentless migration for a VMware VM.', example='0'),
  name?: string(name='Name', description='The name of the migration job.', example='testMigrationTaskName'),
  ownerId?: long(name='OwnerId'),
  pageNumber?: int32(name='PageNumber', description='The page number. Minimum value: 1.

Default value: 1.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page. Valid values: 1 to 50.

Default value: 10.', example='10'),
  regionId?: string(name='RegionId', description='The ID of the Alibaba Cloud region to which you want to migrate the source server.

For example, if you want to migrate a source server to the China (Hangzhou) region, set this parameter to `cn-hangzhou`. You can call the [DescribeRegions](https://help.aliyun.com/document_detail/25609.html) operation to query the latest regions.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group.', example='rg-acfmw3ty5y7****'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  sourceId?: [ string ](name='SourceId', description='The IDs of the source servers. You can specify a maximum of 50 IDs.', example='s-bp1e2fsl57knvuug****'),
  status?: string(name='Status', description='The status of the migration job. Valid values:

*   Ready: The migration job is not started.
*   Running: The migration job is running.
*   Stopped: The migration job is paused.
*   InError: An error occurs in the migration job.
*   Finished: The migration job is complete.
*   Waiting: The migration job is waiting to run.
*   Expired: The migration job has expired.
*   Deleting: The migration job is being deleted.', example='Ready'),
  tag?: [ 
    {
      key?: string(name='Key', description='The key of the tag N that is added to the SMC resource. Valid values of N: 1 to 20.

The tag key can be an empty string. It can be up to 64 characters in length and cannot contain http:// or https://.', example='TestKey'),
      value?: string(name='Value', description='The value of tag N that is added to the SMC resource. Valid values of N: 1 to 20.

The tag value can be an empty string. It can be up to 64 characters in length and cannot contain http:// or https://.[](http://https://。)', example='TestValue'),
    }
  ](name='Tag', description='The information about tags that are attached to the SMC resource.'),
}

model DescribeReplicationJobsResponseBody = {
  pageNumber?: int32(name='PageNumber', description='The page number of the returned page.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries returned on each page.', example='10'),
  replicationJobs?: {
    replicationJob?: [ 
    {
      businessStatus?: string(name='BusinessStatus', description='The business status of the migration job. Valid values:

*   Preparing: The migration is being prepared.
*   Syncing: Data is being synchronized.
*   Processing: The migration is in progress.
*   Cleaning: Intermediate resources are being released.', example='Preparing'),
      containerNamespace?: string(name='ContainerNamespace', description='The namespace of the destination Docker container image.', example='testNamespace'),
      containerRepository?: string(name='ContainerRepository', description='The repository that stores the destination Docker container image.', example='testRepository'),
      containerTag?: string(name='ContainerTag', description='The tag of the destination Docker container image.', example='CentOS:v1'),
      creationTime?: string(name='CreationTime', description='The time when the migration job was created.', example='2014-07-24T13:00:52Z'),
      dataDisks?: {
        dataDisk?: [ 
        {
          index?: int32(name='Index', description='The index number of the data disk.', example='1'),
          parts?: {
            part?: [ 
            {
              block?: boolean(name='Block', description='Indicates whether block replication is enabled for the data disk partition.', example='true'),
              device?: string(name='Device', description='The device ID of the data disk partition.', example='0_1'),
              sizeBytes?: long(name='SizeBytes', description='The size of the data disk partition. Unit: bytes.', example='21474836480'),
            }
          ](name='Part')
          }(name='Parts', description='The data disk partitions.'),
          size?: int32(name='Size', description='The size of the data disk. Unit: GiB.', example='40'),
        }
      ](name='DataDisk')
      }(name='DataDisks', description='The data disks on the destination ECS instance.'),
      description?: string(name='Description', description='The description of the migration job.', example='This is my migration task.'),
      disks?: {
        data?: {
          data?: [ 
          {
            diskId?: string(name='DiskId', description='The ID of the data disk.', example='d-2zeh4twm100qskw7z41z'),
            LVM?: boolean(name='LVM', description='Specifies whether to use LVM. Valid values:

*   true: Use LVM.
*   false: Not use LVM.', example='false'),
            parts?: {
              part?: [ 
              {
                block?: boolean(name='Block', description='Whether block replication is enabled for the data disk partition. Valid values:

*   true: Block replication is enabled for the data disk partition.
*   false: Block replication is disabled for the data disk partition.', example='false'),
                path?: string(name='Path', description='The path of the data disk partition.', example='/home/data'),
                sizeBytes?: long(name='SizeBytes', description='The size of the data disk partition. Unit: bytes.', example='21474836480'),
              }
            ](name='Part')
            }(name='Parts', description='The information about the data disk partition.'),
            size?: int32(name='Size', description='The size of a data disk on the destination ECS instance. Unit: GiB. Valid values: 20 to 32768.

>  The size of a destination data disk must be larger than the size of data in the corresponding source data disk. For example, if the size of the source disk is 500 GiB but the actual used space is 100 GiB, you must set this parameter to a value greater than 100 GiB.', example='22548578304'),
          }
        ](name='Data')
        }(name='Data', description='The information about the data disk.'),
        system?: {
          diskId?: string(name='DiskId', description='The ID of the system disk.', example='d-2zeh4twm100qskw7z41z'),
          LVM?: boolean(name='LVM', description='Specifies whether to use LVM. Valid values:

*   true: Use LVM.
*   false: Not use LVM.', example='false'),
          parts?: {
            part?: [ 
            {
              block?: boolean(name='Block', description='Specifies whether block replication is enabled for the system disk partition. Valid values:

*   true: Block replication is enabled for the system disk partition.
*   false: Block replication is disabled for the system disk partition.', example='true'),
              path?: string(name='Path', description='The path of the system disk partition.', example='/boot'),
              sizeBytes?: long(name='SizeBytes', description='The size of the system disk partition. Unit: bytes.', example='21474836480'),
            }
          ](name='Part')
          }(name='Parts', description='The information about the system disk partition.'),
          size?: int32(name='Size', description='The size of the source system disk. Unit: GiB. Valid values: 20 to 32768.

>  The parameter value must be greater than the actual used space of the data disk on the source server. For example, if the size of the source disk is 500 GiB but the actual used space is 100 GiB, you must set this parameter to a value greater than 100 GiB.', example='100'),
        }(name='System', description='The information about the system disk.'),
      }(name='Disks', description='The information about the disk.'),
      endTime?: string(name='EndTime', description='The time when the migration job was complete. The time follows the [ISO 8601](https://help.aliyun.com/document_detail/25696.html) standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

>  The time displayed in the SMC console is in the format of UTC+8.', example='2019-06-04T16:00:52Z'),
      errorCode?: string(name='ErrorCode', description='The error code returned if an error occurred in the migration job.', example='InternalError'),
      frequency?: int32(name='Frequency', description='The interval at which the incremental migration job runs. Unit: hour. Valid values: 1 to 168.', example='15'),
      imageId?: string(name='ImageId', description='The ID of the destination image.', example='m-o6w3gy99qf89rkga****'),
      imageName?: string(name='ImageName', description='The name of the destination image.', example='testAliCloudImageName'),
      instanceId?: string(name='InstanceId', description='The ID of the destination ECS instance.', example='i-bp1ff25rzvnul6kr****'),
      instanceRamRole?: string(name='InstanceRamRole', description='The name of the Resource Access Management (RAM) role that is assigned to the instance.', example='SMCAdmin'),
      instanceType?: string(name='InstanceType', description='The instance type of the intermediate instance.', example='ecs.sn1ne.large'),
      jobId?: string(name='JobId', description='The ID of the migration job.', example='j-bp19vlwm0tyigbmj****'),
      jobType?: int32(name='JobType', description='The type of the migration job. Valid values:

*   0: server migration.
*   1: operating system migration.
*   2: cross-zone migration.
*   3: agentless migration for a VMware VM.', example='0'),
      launchTemplateId?: string(name='LaunchTemplateId', description='The ID of the launch template.', example='lt-launchtemplateid'),
      launchTemplateVersion?: string(name='LaunchTemplateVersion', description='The versions of the launch template.', example='1'),
      licenseType?: string(name='LicenseType', description='The type of license for the migration job. Valid values:

*   An empty value indicates no license.
*   A value of BYOL indicates Bring Your Own License (BYOL).', example='BYOL'),
      maxNumberOfImageToKeep?: int32(name='MaxNumberOfImageToKeep', description='The maximum number of images retained for the incremental migration job. Valid values: 1 to 10.', example='8'),
      name?: string(name='Name', description='The name of the migration job.', example='testMigrationTaskName'),
      netMode?: int32(name='NetMode', description='The type of network used for the migration.', example='0'),
      progress?: float(name='Progress', description='The progress of the migration job.', example='100'),
      regionId?: string(name='RegionId', description='The ID of the Alibaba Cloud region to which the source server is migrated.', example='cn-hangzhou'),
      replicationJobRuns?: {
        replicationJobRun?: [ 
        {
          endTime?: string(name='EndTime', description='The time when the migration job ended. The time follows the [ISO 8601](https://help.aliyun.com/document_detail/25696.html) standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

>  The time displayed in the SMC console is in the format of UTC+8.', example='2019-10-04T13:35:00Z'),
          imageId?: string(name='ImageId', description='The ID of the destination image.', example='m-o6w3gy99qf89rkga****'),
          startTime?: string(name='StartTime', description='The time when the migration job was started. The time follows the [ISO 8601](https://help.aliyun.com/document_detail/25696.html) standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

>  The time displayed in the SMC console is in the format of UTC+8.', example='2019-10-01T13:35:00Z'),
          type?: string(name='Type', description='The method used to run the migration job. Valid values:

*   Manual: The migration job was manually started.
*   Schedule: The migration job was started at a scheduled time or at a specific interval.', example='Schedule'),
        }
      ](name='ReplicationJobRun')
      }(name='ReplicationJobRuns', description='The execution records of the migration job.'),
      replicationParameters?: string(name='ReplicationParameters', description='The string of key-value pairs configured for the replication driver.', example='BandWidthLimit:0'),
      resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group.', example='rg-acfmw3ty5y7****'),
      runOnce?: boolean(name='RunOnce', description='Indicates whether incremental migration is disabled for the source server. Valid values:

*   true: Incremental migration is disabled. A migration job runs only once after the job is created.
*   false: Incremental migration is enabled. For an incremental migration job, SMC synchronizes incremental data to Alibaba Cloud at the interval specified by the `Frequency` parameter.', example='true'),
      scheduledStartTime?: string(name='ScheduledStartTime', description='The time when the migration job is scheduled to run. The time follows the [ISO 8601](https://help.aliyun.com/document_detail/25696.html) standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC. The time must meet the following requirements:

*   The value must be within 30 days after the current time.
*   If you do not specify this parameter, you must manually start the migration job after the migration job is created. You can call the [StartReplicationJob](https://help.aliyun.com/document_detail/121823.html) operation to start the migration job.', example='2019-06-04T13:35:00Z'),
      sourceId?: string(name='SourceId', description='The ID of the source server.', example='s-bp1e2fsl57knvuug****'),
      startTime?: string(name='StartTime', description='The time when the migration job was started. The time follows the [ISO 8601](https://help.aliyun.com/document_detail/25696.html) standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

>  The time displayed in the SMC console is in the format of UTC+8.', example='2019-06-04T14:40:52Z'),
      status?: string(name='Status', description='The status of the migration job. Valid values:

*   Ready: The migration job is not started.
*   Running: The migration job is running.
*   Stopped: The migration job is paused.
*   InError: An error occurs in the migration job.
*   Finished: The migration job is complete.
*   Waiting: The migration job is waiting to run.
*   Expired: The migration job has expired.
*   Deleting: The migration job is being deleted.', example='Running'),
      statusInfo?: string(name='StatusInfo', description='The status information about the migration job.', example='statusinfo'),
      systemDiskParts?: {
        systemDiskPart?: [ 
        {
          block?: boolean(name='Block', description='Indicates whether block replication is enabled for the system disk partition.', example='true'),
          device?: string(name='Device', description='The device ID of the system disk partition.', example='0_1'),
          sizeBytes?: long(name='SizeBytes', description='The size of the system disk partition. Unit: bytes.', example='254803968'),
        }
      ](name='SystemDiskPart')
      }(name='SystemDiskParts', description='The system disk partitions.'),
      systemDiskSize?: int32(name='SystemDiskSize', description='The size of the system disk of the destination ECS instance.', example='40'),
      tags?: {
        tag?: [ 
        {
          key?: string(name='Key', description='The key of the tag N that is added to the SMC resource. Valid values of N: 1 to 20.

The tag key can be an empty string. It can be up to 64 characters in length and cannot contain http:// or https://.[](http://https://。)', example='TestKey'),
          value?: string(name='Value', description='The value of tag N that is added to the SMC resource. Valid values of N: 1 to 20.

The tag value can be an empty string. It can be up to 64 characters in length and cannot contain http:// or https://.[](http://https://。)', example='TestValue'),
        }
      ](name='Tag')
      }(name='Tags', description='The information about tags that are attached to the SMC resource.'),
      targetType?: string(name='TargetType', description='The type of destination to which the source server is migrated. Valid values:

*   Image: After the migration job is complete, SMC generates an ECS image for the source server.
*   ContainerImage: After the migration job is complete, SMC generates a Docker container image for the source server.
*   TargetInstance: After the migration job is complete, SMC migrates the source server to the destination instance. If you set this parameter to TargetInstance, you must set the InstanceId parameter.', example='Image'),
      transitionInstanceId?: string(name='TransitionInstanceId', description='The ID of the intermediate instance.', example='i-bp1ff25rzvnul6kr****'),
      vSwitchId?: string(name='VSwitchId', description='The ID of the vSwitch in the specified VPC.', example='vsw-bp1ddbrxdlrcbim46****'),
      validTime?: string(name='ValidTime', description='The time when the migration job expired. The time follows the [ISO 8601](https://help.aliyun.com/document_detail/25696.html) standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

>  The time displayed in the SMC console is in the format of UTC+8.', example='2019-06-08T14:40:52Z'),
      vpcId?: string(name='VpcId', description='The ID of a virtual private cloud (VPC) for which you have configured an Express Connect circuit or a VPN gateway.', example='vpc-bp1vwnn14rqpyiczj****'),
    }
  ](name='ReplicationJob')
  }(name='ReplicationJobs', description='The details of migration jobs.'),
  requestId?: string(name='RequestId', description='The request ID.', example='6E1187E8-843A-4850-B97E-2F17F00D48F7'),
  totalCount?: int32(name='TotalCount', description='The total number of migration jobs returned.', example='5'),
}

model DescribeReplicationJobsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeReplicationJobsResponseBody(name='body'),
}

/**
 * @summary Queries the details of migration jobs.
 *
 * @description ## Usage notes
 * *   You can specify multiple request parameters to be queried. Specified parameters are evaluated by using the AND operator. Only the specified parameters are used as filter conditions.
 * *   Server Migration Center (SMC) allows you to migrate source servers to Docker container images. You can use SMC to migrate containerized applications in a cost-effective way. For more information, see [Terms](https://help.aliyun.com/document_detail/60744.html).
 *
 * @param request DescribeReplicationJobsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeReplicationJobsResponse
 */
async function describeReplicationJobsWithOptions(request: DescribeReplicationJobsRequest, runtime: Util.RuntimeOptions): DescribeReplicationJobsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.businessStatus)) {
    query['BusinessStatus'] = request.businessStatus;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.jobId)) {
    query['JobId'] = request.jobId;
  }
  if (!Util.isUnset(request.jobType)) {
    query['JobType'] = request.jobType;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.sourceId)) {
    query['SourceId'] = request.sourceId;
  }
  if (!Util.isUnset(request.status)) {
    query['Status'] = request.status;
  }
  if (!Util.isUnset(request.tag)) {
    query['Tag'] = request.tag;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeReplicationJobs',
    version = '2019-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the details of migration jobs.
 *
 * @description ## Usage notes
 * *   You can specify multiple request parameters to be queried. Specified parameters are evaluated by using the AND operator. Only the specified parameters are used as filter conditions.
 * *   Server Migration Center (SMC) allows you to migrate source servers to Docker container images. You can use SMC to migrate containerized applications in a cost-effective way. For more information, see [Terms](https://help.aliyun.com/document_detail/60744.html).
 *
 * @param request DescribeReplicationJobsRequest
 * @return DescribeReplicationJobsResponse
 */
async function describeReplicationJobs(request: DescribeReplicationJobsRequest): DescribeReplicationJobsResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeReplicationJobsWithOptions(request, runtime);
}

model DescribeSourceServersRequest {
  jobId?: string(name='JobId', description='The ID of the migration job.', example='j-bp19vlwm0tyigbmj****'),
  name?: string(name='Name', description='The name of the migration source. The name must be 2 to 128 characters in length. It must start with a letter but cannot start with http:// or https://. It can contain digits, colons (:), underscores (_), and hyphens (-).

This parameter is empty by default.', example='testSourceServerName'),
  ownerId?: long(name='OwnerId'),
  pageNumber?: int32(name='PageNumber', description='The page number. Minimum value: 1.

Default value: 1.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page. Valid values: 1 to 50.

Default value: 10.', example='10'),
  relatedJobType?: [ string ](name='RelatedJobType', description='The type of migration job that is associated with the migration source.'),
  resourceGroupId?: string(name='ResourceGroupId', description='The resource group ID.', example='rg-acfmw3ty5y7****'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  sourceId?: [ string ](name='SourceId', description='The migration source ID. You can specify multiple IDs.', example='s-bp1e2fsl57knvuug****'),
  state?: string(name='State', description='The state of the migration source. Valid values:

*   Unavailable: The migration source is inactive, or an error occurs in the migration source.
*   Available: The migration source is active.
*   InUse: The migration source is being migrated.
*   Deleting: The migration source is being deleted from Server Migration Center (SMC).', example='Available'),
  tag?: [ 
    {
      key?: string(name='Key', description='The key of tag N that is attached to the SMC resource. Valid values of N: 1 to 20.

You cannot specify an empty string as a tag key. The tag key can be up to 64 characters in length and cannot contain http:// or https://. The tag key cannot start with acs: or aliyun.', example='TestKey'),
      value?: string(name='Value', description='The value of tag N that is attached to the SMC resource. Valid values of N: 1 to 20.

You can specify an empty string as a tag key. The tag value can be up to 64 characters in length and cannot contain http:// or https://.', example='TestValue'),
    }
  ](name='Tag', description='The tag.'),
  workgroupId?: string(name='WorkgroupId', description='The workgroup ID.', example='w-bp1ja22kdqphehlj****'),
}

model DescribeSourceServersResponseBody = {
  pageNumber?: int32(name='PageNumber', description='The page number.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries returned on each page.', example='10'),
  requestId?: string(name='RequestId', description='The request ID.', example='410E6073-66D0-45D3-AB3E-4DC3F5E4****'),
  sourceServers?: {
    sourceServer?: [ 
    {
      agentVersion?: string(name='AgentVersion', description='The version number of the SMC client.', example='1.5.2.3'),
      architecture?: string(name='Architecture', description='The system architecture of the migration source.', example='x86_64'),
      creationTime?: string(name='CreationTime', description='The time when the migration source was created.', example='2019-06-27T02:58:09Z'),
      dataDisks?: {
        dataDisk?: [ 
        {
          index?: int32(name='Index', description='The index number of the data disk.', example='1'),
          parts?: {
            part?: [ 
            {
              canBlock?: boolean(name='CanBlock', description='Indicates whether block replication is enabled for the data disk partition.', example='false'),
              device?: string(name='Device', description='The device ID of the data disk partition.', example='1_0'),
              need?: boolean(name='Need', description='Indicates whether the data disk partition must be selected.', example='false'),
              path?: string(name='Path', description='The path of the data disk partition.', example='/home/data'),
              sizeBytes?: long(name='SizeBytes', description='The size of the data disk partition. Unit: bytes.', example='21474836480'),
            }
          ](name='Part')
          }(name='Parts', description='The information about the data disk partition.'),
          path?: string(name='Path', description='The path of data disk N.', example='/home/data'),
          size?: int32(name='Size', description='The size of data disk N. Unit: GiB.', example='20'),
        }
      ](name='DataDisk')
      }(name='DataDisks', description='The data disks on the migration source.'),
      description?: string(name='Description', description='The description of the migration source.', example='Server Source Imported By GotoAliyun.'),
      disks?: {
        data?: {
          data?: [ 
          {
            offset?: long(name='Offset', description='The start offset of the first partition of the data disk. Unit: bytes.', example='1024'),
            parts?: {
              part?: [ 
              {
                canBlock?: boolean(name='CanBlock', description='Whether block replication is enabled for the data disk partition. Valid values:

*   true: Block replication is enabled for the data disk partition.
*   false: Block replication is disabled for the data disk partition.', example='false'),
                path?: string(name='Path', description='The path of the data disk partition.', example='/home/data'),
                sizeBytes?: long(name='SizeBytes', description='The size of the data disk partition. Unit: bytes.', example='21474836480'),
                type?: string(name='Type', description='The type of the data disk partition. Valid values:

*   Normal: normal partition.
*   System: system partition.
*   Boot: boot partition.', example='Normal'),
              }
            ](name='Part')
            }(name='Parts', description='The information about the data disk partition.'),
            size?: int32(name='Size', description='The data disk size of the migration source. Unit: GiB.', example='80'),
          }
        ](name='Data')
        }(name='Data', description='The list of data disk information.'),
        system?: {
          offset?: long(name='Offset', description='The start offset of the first partition of the system disk. Unit: bytes.', example='1024'),
          parts?: {
            part?: [ 
            {
              canBlock?: boolean(name='CanBlock', description='Indicates whether block replication is enabled for the system disk partition. Valid values:

*   true: Block replication is enabled for the system disk partition.
*   false: Block replication is disabled for the system disk partition.', example='false'),
              path?: string(name='Path', description='The path of the system disk partition.', example='/home/data'),
              sizeBytes?: long(name='SizeBytes', description='The size of the system disk partition. Unit: bytes.', example='21474836480'),
              type?: string(name='Type', description='The type of the system disk partition. Valid values:

*   Normal: normal partition.
*   System: system partition.
*   Boot: boot partition.', example='Normal'),
            }
          ](name='Part')
          }(name='Parts', description='The information about the system disk partition.'),
          size?: int32(name='Size', description='The size of the source system disk. Unit: GiB. Valid values: 20 to 32768.

>  The parameter value must be greater than the actual used space of the data disk on the source server. For example, if the size of the source disk is 500 GiB but the actual used space is 100 GiB, you must set this parameter to a value greater than 100 GiB.', example='100'),
        }(name='System', description='The information about the system disk.', nullable=false),
      }(name='Disks', description='The information about the disk.', nullable=false),
      errorCode?: string(name='ErrorCode', description='The error code of the migration source.', example='SourceServer.Offline'),
      heartbeatRate?: int32(name='HeartbeatRate', description='The interval at which heartbeats are sent from the SMC client. Unit: seconds.', example='30'),
      jobId?: string(name='JobId', description='The ID of the last migration job.', example='j-bp19vlwm0tyigbmj****'),
      kernelLevel?: int32(name='KernelLevel', description='The kernel level of the migration source.', example='1'),
      name?: string(name='Name', description='The name of the migration source.', example='SourceServerName'),
      platform?: string(name='Platform', description='The operating system of the migration source.', example='OpenSUSE'),
      replicationDriver?: string(name='ReplicationDriver', description='The replication driver used for migration. Default value: SMT.', example='SMT'),
      resourceGroupId?: string(name='ResourceGroupId', description='The resource group ID.', example='rg-acfmw3ty5y7****'),
      sourceId?: string(name='SourceId', description='The ID of the migration source.', example='s-bp1e2fsl57knvuug****'),
      state?: string(name='State', description='The state of the migration source.', example='InUse'),
      statusInfo?: string(name='StatusInfo', description='The status information of the migration source. This parameter is returned if the migration source is in the Unavailable state. The value of this parameter consists of key-value pairs in the JSON format. Sample keys:

    error_code: The error code.
    error_msg: the error message.', example='{"error_code": "S1", "error_msg": "Rsync not found. Please install rsync."}'),
      systemDiskParts?: {
        systemDiskPart?: [ 
        {
          canBlock?: boolean(name='CanBlock', description='Indicates whether block replication is enabled for the system disk partition.', example='true'),
          device?: string(name='Device', description='The device ID of the system disk partition.', example='0_0'),
          need?: boolean(name='Need', description='Indicates whether the system disk partition must be selected.', example='true'),
          path?: string(name='Path', description='The path of the system disk partition.', example='/boot'),
          sizeBytes?: long(name='SizeBytes', description='The size of the system disk partition. Unit: bytes.', example='254803968'),
        }
      ](name='SystemDiskPart')
      }(name='SystemDiskParts', description='The information about the system disk partition.'),
      systemDiskSize?: int32(name='SystemDiskSize', description='The system disk size of the migration source. Unit: GiB', example='40'),
      systemInfo?: string(name='SystemInfo', description='The system information of the migration source. The parameter must be specified as key-value pairs in the JSON format. The key-value pairs are extensible and have fixed keys. Maximum value: 1 KB. Example:

    agent_mode: the running mode.
    agent_type: the type of the run.
    client_type: the type of the client.
    hostname : the hostname.
    ipv4:IPv4 address
    ipv6: IPv6 address
    cores: the number of CPU cores.
    cpu_usage: the CPU utilization.
    memory: the memory size.
    memory_usage: the memory usage.', example='{\\\\"agent_mode\\\\":\\\\"daemon\\\\",\\\\"agent_type\\\\":\\\\"aliyun\\\\",\\\\"client_type\\\\":\\\\"\\\\",\\\\"cores\\\\":\\\\"2\\\\",\\\\"cpu_usage\\\\":\\\\"0.00\\\\",\\\\"hostname\\\\":\\\\"ixxxxxxxxxx\\\\",\\\\"ipv4\\\\":\\\\"10.0.0.1\\\\",\\\\"memory\\\\":\\\\"8.00\\\\",\\\\"memory_usage\\\\":\\\\"3.61\\\\"}'),
      tags?: {
        tag?: [ 
        {
          key?: string(name='Key', description='The key of tag N that is attached to the SMC resource. Valid values of N: 1 to 20.

You cannot specify an empty string as a tag key. The tag key can be up to 64 characters in length and cannot contain http:// or https://. The tag key cannot start with acs: or aliyun.', example='TestKey'),
          value?: string(name='Value', description='The value of tag N that is attached to the SMC resource. Valid values of N: 1 to 20.

The tag key can be an empty string. The tag value can be up to 64 characters in length and cannot contain http:// or https://.', example='TestValue'),
        }
      ](name='Tag')
      }(name='Tags', description='The tag details.'),
      workgroupId?: string(name='WorkgroupId', description='The workgroup ID.', example='w-bp1ja22kdqphehlj****'),
    }
  ](name='SourceServer')
  }(name='SourceServers', description='The information about the migration source.'),
  totalCount?: int32(name='TotalCount', description='The total number of migration sources returned.', example='1'),
}

model DescribeSourceServersResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeSourceServersResponseBody(name='body'),
}

/**
 * @summary Queries the information about one or more source servers.
 *
 * @description ## [](#)Usage notes
 * You can specify multiple request parameters to filter instances. Specified parameters have logical AND relations. Only the specified parameters are used as filter conditions.
 *
 * @param request DescribeSourceServersRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeSourceServersResponse
 */
async function describeSourceServersWithOptions(request: DescribeSourceServersRequest, runtime: Util.RuntimeOptions): DescribeSourceServersResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.jobId)) {
    query['JobId'] = request.jobId;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.relatedJobType)) {
    query['RelatedJobType'] = request.relatedJobType;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.sourceId)) {
    query['SourceId'] = request.sourceId;
  }
  if (!Util.isUnset(request.state)) {
    query['State'] = request.state;
  }
  if (!Util.isUnset(request.tag)) {
    query['Tag'] = request.tag;
  }
  if (!Util.isUnset(request.workgroupId)) {
    query['WorkgroupId'] = request.workgroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeSourceServers',
    version = '2019-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the information about one or more source servers.
 *
 * @description ## [](#)Usage notes
 * You can specify multiple request parameters to filter instances. Specified parameters have logical AND relations. Only the specified parameters are used as filter conditions.
 *
 * @param request DescribeSourceServersRequest
 * @return DescribeSourceServersResponse
 */
async function describeSourceServers(request: DescribeSourceServersRequest): DescribeSourceServersResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeSourceServersWithOptions(request, runtime);
}

model DescribeWorkgroupsRequest {
  name?: string(name='Name', description='The name of the workgroup.', example='test'),
  ownerId?: long(name='OwnerId'),
  pageNumber?: int32(name='PageNumber', description='The page number. Minimum value: 1. Default value: 1.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page. Valid values: 1 to 50. Default value: 10.', example='10'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  status?: string(name='Status', description='The state of the workgroup. Valid values:

*   NotStarted
*   InProgress
*   Cutover
*   Completed', example='InProgress'),
  tag?: [ 
    {
      key?: string(name='Key', description='The tag key of the workgroup. Valid values of N: 1 to 20.

You cannot specify an empty string as a tag key. The tag key can be up to 64 characters in length and cannot contain http:// or https://. The tag key cannot start with acs: or aliyun.', example='TestKey'),
      value?: string(name='Value', description='The tag value of the workgroup. Valid values of N: 1 to 20.

You can specify an empty string as a tag value. The tag value can be up to 64 characters in length and cannot contain http:// or https://.', example='TestValue'),
    }
  ](name='Tag', description='The list of tag information of workgroups.'),
  workgroupId?: [ string ](name='WorkgroupId', description='The workgroup IDs. You can specify up to 50 workgroup IDs.'),
}

model DescribeWorkgroupsResponseBody = {
  pageNumber?: int32(name='PageNumber', description='The page number.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page. Valid values: 1 to 50. Default value: 10.', example='10'),
  requestId?: string(name='RequestId', description='The request ID.', example='2D69A58F-345C-4FDE-88E4-BF518948****'),
  totalCount?: int32(name='TotalCount', description='The total number of workgroups.', example='1'),
  workgroups?: {
    workgroup?: [ 
    {
      description?: string(name='Description', description='The description of the workgroup.', example='test'),
      name?: string(name='Name', description='The name of the workgroup.', example='testWorkgroupName'),
      status?: string(name='Status', description='The state of the workgroup. Valid values:

*   NotStarted
*   InProgress
*   Cutover
*   Completed', example='InProgress'),
      tags?: {
        tag?: [ 
        {
          key?: string(name='Key', description='The tag key of the workgroup.

You can specify an empty string as a tag key. The tag key can be up to 64 characters in length and cannot contain http:// or https://.', example='TestKey'),
          value?: string(name='Value', description='The tag value of the workgroup. Valid values of N: 1 to 20.

You can specify an empty string as a tag value. The tag value can be up to 64 characters in length and cannot contain http:// or https://.', example='TestValue'),
        }
      ](name='Tag')
      }(name='Tags', description='The tag information of the workgroup.'),
      warnings?: {
        warning?: [ 
        {
          sourceIds?: {
            sourceId?: [ string ](name='SourceId')
          }(name='SourceIds', description='The migration sources for which alerts are generated.'),
          warningType?: string(name='WarningType', description='The type of the alert. Valid values:

*   InError: A migration job failed.
*   UnRelated: No migration job is created for a migration source.
*   NotPassed: A migration job failed to pass the migration test.', example='InError'),
        }
      ](name='Warning')
      }(name='Warnings', description='The alert information of the workgroup, which can contain multiple types of alerts.'),
      workgroupId?: string(name='WorkgroupId', description='The workgroup ID.', example='w-***'),
    }
  ](name='Workgroup')
  }(name='Workgroups', description='The queried workgroups.'),
}

model DescribeWorkgroupsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeWorkgroupsResponseBody(name='body'),
}

/**
 * @summary Queries the information about workgroups. After you create a workgroup, you can query the information about the workgroup, such as the name, description, and alert information.
 *
 * @param request DescribeWorkgroupsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeWorkgroupsResponse
 */
async function describeWorkgroupsWithOptions(request: DescribeWorkgroupsRequest, runtime: Util.RuntimeOptions): DescribeWorkgroupsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.status)) {
    query['Status'] = request.status;
  }
  if (!Util.isUnset(request.tag)) {
    query['Tag'] = request.tag;
  }
  if (!Util.isUnset(request.workgroupId)) {
    query['WorkgroupId'] = request.workgroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeWorkgroups',
    version = '2019-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the information about workgroups. After you create a workgroup, you can query the information about the workgroup, such as the name, description, and alert information.
 *
 * @param request DescribeWorkgroupsRequest
 * @return DescribeWorkgroupsResponse
 */
async function describeWorkgroups(request: DescribeWorkgroupsRequest): DescribeWorkgroupsResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeWorkgroupsWithOptions(request, runtime);
}

model DisableAccessTokenRequest {
  accessTokenId?: string(name='AccessTokenId', description='The ID of the activation code.

This parameter is required.', example='at-bp12g5gwup0yzmce****'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
}

model DisableAccessTokenResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='686BB8A6-BBA5-47E5-8A75-D2ADE433****'),
}

model DisableAccessTokenResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DisableAccessTokenResponseBody(name='body'),
}

/**
 * @summary Disables an activation code.
 *
 * @description To prevent an activation code from being leaked, you can call this operation to disable the activation code. Disabled activation codes can no longer be used to import the information about migration sources. However, migration sources whose information has been imported are not affected.
 *
 * @param request DisableAccessTokenRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DisableAccessTokenResponse
 */
async function disableAccessTokenWithOptions(request: DisableAccessTokenRequest, runtime: Util.RuntimeOptions): DisableAccessTokenResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accessTokenId)) {
    query['AccessTokenId'] = request.accessTokenId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DisableAccessToken',
    version = '2019-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Disables an activation code.
 *
 * @description To prevent an activation code from being leaked, you can call this operation to disable the activation code. Disabled activation codes can no longer be used to import the information about migration sources. However, migration sources whose information has been imported are not affected.
 *
 * @param request DisableAccessTokenRequest
 * @return DisableAccessTokenResponse
 */
async function disableAccessToken(request: DisableAccessTokenRequest): DisableAccessTokenResponse {
  var runtime = new Util.RuntimeOptions{};
  return disableAccessTokenWithOptions(request, runtime);
}

model DisassociateSourceServersRequest {
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  sourceId?: [ string ](name='SourceId', description='The IDs of migration sources that you want to disassociate from the workgroup. You can specify up to 50 migration sources.

This parameter is required.'),
  workgroupId?: string(name='WorkgroupId', description='The ID of the workgroup.

This parameter is required.', example='w-***'),
}

model DisassociateSourceServersResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='3E8B9ABB-289A-44E6-942D-8AA9E493****'),
}

model DisassociateSourceServersResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DisassociateSourceServersResponseBody(name='body'),
}

/**
 * @summary Disassociates migration sources from a workgroup. If you do not need to use a workgroup to migrate migration sources, you can disassociate the migration sources from the workgroup.
 *
 * @param request DisassociateSourceServersRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DisassociateSourceServersResponse
 */
async function disassociateSourceServersWithOptions(request: DisassociateSourceServersRequest, runtime: Util.RuntimeOptions): DisassociateSourceServersResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.sourceId)) {
    query['SourceId'] = request.sourceId;
  }
  if (!Util.isUnset(request.workgroupId)) {
    query['WorkgroupId'] = request.workgroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DisassociateSourceServers',
    version = '2019-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Disassociates migration sources from a workgroup. If you do not need to use a workgroup to migrate migration sources, you can disassociate the migration sources from the workgroup.
 *
 * @param request DisassociateSourceServersRequest
 * @return DisassociateSourceServersResponse
 */
async function disassociateSourceServers(request: DisassociateSourceServersRequest): DisassociateSourceServersResponse {
  var runtime = new Util.RuntimeOptions{};
  return disassociateSourceServersWithOptions(request, runtime);
}

model ListAccessTokensRequest {
  accessTokenId?: [ string ](name='AccessTokenId', description='The information about activation codes.'),
  name?: string(name='Name', description='The name of the activation code.', example='test_name'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  status?: string(name='Status', description='The status of the activation code. Valid values:

*   activated
*   unactivated
*   expired', example='activated'),
}

model ListAccessTokensResponseBody = {
  accessTokens?: {
    accessToken?: [ 
    {
      accessTokenId?: string(name='AccessTokenId', description='The ID of the activation code.', example='at-bp1akz2zp67r0k6r****'),
      count?: string(name='Count', description='The maximum number of times that the activation code can be used. Valid values: 1 to 1000.

Default value: 100.', example='100'),
      creationTime?: string(name='CreationTime', description='The time when the activation code was created. The time follows the [ISO 8601](https://help.aliyun.com/document_detail/25696.html) standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.', example='2022-09-09T02:35:44Z'),
      description?: string(name='Description', description='The description of the activation code.', example='This is an activation code'),
      name?: string(name='Name', description='The name of the activation code.', example='test_name'),
      registeredCount?: string(name='RegisteredCount', description='The number of migration sources whose information has been imported to Server Migration Center (SMC) by using the activation code.', example='5'),
      status?: string(name='Status', description='The status of the activation code. Valid values:

*   activated
*   unactivated
*   expired', example='activated'),
      timeToLiveInDays?: string(name='TimeToLiveInDays', description='The validity period of the activation code. Unit: day. Valid values: 1 to 90. Default value: 30.', example='30'),
    }
  ](name='AccessToken')
  }(name='AccessTokens', description='The activation codes returned.'),
  pageNumber?: int32(name='PageNumber', description='The number of entries per page. Valid values:

*   10
*   20
*   50

Default value: 20.', example='20'),
  pageSize?: int32(name='PageSize', description='The page number.', example='1'),
  requestId?: string(name='RequestId', description='The request ID.', example='E2DA3097-79B9-53AE-B0DF-281DC54F****'),
  totalCount?: int32(name='TotalCount', description='The total number of migration sources returned.', example='2'),
}

model ListAccessTokensResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListAccessTokensResponseBody(name='body'),
}

/**
 * @summary Queries activation codes and the usage details of the activation codes.
 *
 * @description You can call this operation to query activation codes and the usage details of the activation codes. An activation code can be in the activated, unactivated, or expired state.
 *
 * @param request ListAccessTokensRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListAccessTokensResponse
 */
async function listAccessTokensWithOptions(request: ListAccessTokensRequest, runtime: Util.RuntimeOptions): ListAccessTokensResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accessTokenId)) {
    query['AccessTokenId'] = request.accessTokenId;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.status)) {
    query['Status'] = request.status;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListAccessTokens',
    version = '2019-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries activation codes and the usage details of the activation codes.
 *
 * @description You can call this operation to query activation codes and the usage details of the activation codes. An activation code can be in the activated, unactivated, or expired state.
 *
 * @param request ListAccessTokensRequest
 * @return ListAccessTokensResponse
 */
async function listAccessTokens(request: ListAccessTokensRequest): ListAccessTokensResponse {
  var runtime = new Util.RuntimeOptions{};
  return listAccessTokensWithOptions(request, runtime);
}

model ListTagResourcesRequest {
  nextToken?: string(name='NextToken', description='The pagination token that is used in the next request to retrieve a new page of results.', example='caeba0bbb2be03f84eb48b699f0a4883'),
  ownerId?: long(name='OwnerId'),
  resourceId?: [ string ](name='ResourceId', description='The IDs of SMC resources. SMC resources include migration sources and migration jobs. You can specify a maximum of 50 SMC resource IDs.', example='s-bp1e2fsl57knvuug****'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceType?: string(name='ResourceType', description='The type of the SMC resource. Valid values:

*   sourceserver: migration source.
*   replicationjob: migration job.

This parameter is required.', example='sourceserver'),
  tag?: [ 
    {
      key?: string(name='Key', description='The key of tag N. The tag key must be 1 to 64 characters in length. Valid values of N: 1 to 20.

Tag.N is used for exact match of SMC resources to which the tag is attached. Tag N consists of a key-value pair.

*   Tag keys and values are case-sensitive.
*   If you set only the Tag.N.Key parameter, all resources to which the specified tags are attached are returned.
*   If you set only the Tag.N.Value parameter, the error message InvalidParameter.TagValue is returned.
*   If you specify multiple tag key-value pairs at a time, only SMC resources that match all tag key-value pairs are returned.', example='TestKey'),
      value?: string(name='Value', description='The value of tag N. The value must be 1 to 64 characters in length. Valid values of N: 1 to 20.', example='TestValue'),
    }
  ](name='Tag', description='The tags that are attached to SMC resources.'),
}

model ListTagResourcesResponseBody = {
  nextToken?: string(name='NextToken', description='The pagination token that is used in the next request to retrieve a new page of results.

If NextToken is empty, no next page exists.', example='caeba0bbb2be03f84eb48b699f0a4883'),
  requestId?: string(name='RequestId', description='The request ID.', example='17743161-66F3-4E7F-B8AE-845FB28B928F'),
  tagResources?: {
    tagResource?: [ 
    {
      resourceId?: string(name='ResourceId', description='The resource ID.', example='s-bp1e2fsl57knvuug****'),
      resourceType?: string(name='ResourceType', description='The type of the resource.', example='ALIYUN::SMC::SOURCESERVER'),
      tagKey?: string(name='TagKey', description='The key of the tag that is attached to the resource.', example='TestKey'),
      tagValue?: string(name='TagValue', description='The value of the tag that is attached to the resource.', example='TestValue'),
    }
  ](name='TagResource')
  }(name='TagResources', description='The information about SMC resources and tags, such as the IDs, types, and tag key-value pairs of the resources.'),
}

model ListTagResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListTagResourcesResponseBody(name='body'),
}

/**
 * @summary Queries the tags that are attached to Server Migration Center (SMC) resources. SMC resources include migration sources and migration jobs.
 *
 * @param request ListTagResourcesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListTagResourcesResponse
 */
async function listTagResourcesWithOptions(request: ListTagResourcesRequest, runtime: Util.RuntimeOptions): ListTagResourcesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.nextToken)) {
    query['NextToken'] = request.nextToken;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  if (!Util.isUnset(request.tag)) {
    query['Tag'] = request.tag;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListTagResources',
    version = '2019-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the tags that are attached to Server Migration Center (SMC) resources. SMC resources include migration sources and migration jobs.
 *
 * @param request ListTagResourcesRequest
 * @return ListTagResourcesResponse
 */
async function listTagResources(request: ListTagResourcesRequest): ListTagResourcesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listTagResourcesWithOptions(request, runtime);
}

model ModifyReplicationJobAttributeRequest {
  containerNamespace?: string(name='ContainerNamespace', description='The namespace of the destination Docker container image. For more information about Docker container images, see [Terms](https://help.aliyun.com/document_detail/60744.html).', example='testNamespace'),
  containerRepository?: string(name='ContainerRepository', description='The repository that stores the destination Docker container image. For more information about Docker container images, see [Terms](https://help.aliyun.com/document_detail/60744.html).', example='testRepository'),
  containerTag?: string(name='ContainerTag', description='The tag of the destination Docker container image. For more information about Docker container images, see [Terms](https://help.aliyun.com/document_detail/60744.html).', example='CentOS:v1'),
  dataDisk?: [ 
    {
      index?: int32(name='Index', description='The index of data disk N on the destination ECS instance. Valid values of N: 1 to 16.

Data disks on a destination ECS instance are arranged in a sequential order that starts from 1.

>  You can create a destination data disk only for a source server that has data disks.', example='1'),
      part?: [ 
        {
          block?: boolean(name='Block', description='Specifies whether to enable block replication for partition N in the destination data disk. Valid values:

*   true
*   false', example='true'),
          device?: string(name='Device', description='The ID of partition N in the destination data disk.

>  The partitions in the destination data disk are arranged in the same sequential order as those in the source data disk.', example='0_1'),
          sizeBytes?: long(name='SizeBytes', description='The size of partition N in the destination data disk. Unit: bytes. The default value is equal to the corresponding size of the partition in the source data disk.

>  The total size of all partitions in the destination data disk cannot exceed the size of the destination data disk.', example='254803968'),
        }
      ](name='Part', description='The information about partitions.'),
      size?: int32(name='Size', description='The size of the data disk on the destination ECS instance. Unit: GiB. Valid values: 20 to 32768.

>  The size of a destination data disk must be greater than the size of data in the source data disk. For example, if the source data disk has 500 GiB of storage space and 100 GiB of data, you must set this parameter to a value greater than 100.', example='100'),
    }
  ](name='DataDisk', description='The information about the data disk.'),
  description?: string(name='Description', description='The description of the migration job.

The description must be 2 to 128 characters in length and can contain letters, digits, colons (:), underscores (_), and hyphens (-). It must start with a letter and cannot start with `http://` or `https://`.', example='This_is_my_migration_task'),
  frequency?: int32(name='Frequency', description='The interval at which an incremental migration job runs. Unit: hour. Valid values: 1 to 168.

This parameter is required if you set the `RunOnce` parameter to false.', example='10'),
  imageName?: string(name='ImageName', description='The name of the destination image. The name must meet the following requirements:

*   The name must be unique within an Alibaba Cloud region.
*   The name must be 2 to 128 characters in length and can contain letters, digits, colons (:), underscores (_), and hyphens (-). It must start with a letter and cannot start with `http://` or `https://`.

>  If an image whose name is the same as that of the destination image already exists in the current region when the migration job is in progress, the system adds the migration job ID to the end of the image name by default. Example: ImageName-JobId.', example='testAliCloudImageName'),
  instanceId?: string(name='InstanceId', description='The destination instance ID.', example='i-bp1f1dvfto1sigz5****'),
  instanceRamRole?: string(name='InstanceRamRole', description='The name of the Resource Access Management (RAM) role that is attached to the intermediate instance.', example='SMCAdmin'),
  instanceType?: string(name='InstanceType', description='The type of the intermediate instance.

You can call the [DescribeInstanceTypes](https://help.aliyun.com/document_detail/25620.html) operation to query the ECS instance types.

*   If you specify this parameter, SMC creates an intermediate instance of the specified instance type. If the specified instance type is unavailable, you cannot create the migration job.
*   If you do not specify this parameter, SMC selects an available instance type in a specific order to create an intermediate instance. For more information,

see the "How does SMC create an intermediate instance?" section of the "FAQ" topic.', example='ecs.c5.large'),
  jobId?: string(name='JobId', description='The migration job ID.

This parameter is required.', example='j-bp19vlwm0tyigbmj****'),
  launchTemplateId?: string(name='LaunchTemplateId', description='The launch template ID.', example='lt-bp16jovvln1cgaaq****'),
  launchTemplateVersion?: string(name='LaunchTemplateVersion', description='The version number of the launch template.', example='Latest'),
  maxNumberOfImageToKeep?: int32(name='MaxNumberOfImageToKeep', description='The maximum number of images that are retained for an incremental migration job. Valid values: 1 to 10.

This parameter is required if you set the `RunOnce` parameter to false.', example='5'),
  name?: string(name='Name', description='The name of the migration job. The name must meet the following requirements:

*   The name must be unique.
*   The name must be 2 to 128 characters in length and can contain letters, digits, colons (:), underscores (_), and hyphens (-). It must start with a letter and cannot start with `http://` or `https://`.', example='testMigrationTaskName'),
  netMode?: int32(name='NetMode', description='The network mode for data transmission. Valid values:

*   0: Data is transmitted over the Internet. Make sure that the source server can access the Internet.
*   2: Data is transmitted over a virtual private cloud (VPC). If you set this parameter to 2, you must specify the VSwitchId parameter. You can leave the VpcId parameter empty, the VPC ID can be queried by calling an operation.', example='0'),
  ownerId?: long(name='OwnerId'),
  replicationParameters?: string(name='ReplicationParameters', description='The parameters of the replication driver. The parameters are fixed key-value pairs of the JSON format. The value can be up to 2,048 characters in length.

A replication driver is a tool that is used to replicate the data of a source server to an intermediate instance. The parameters vary based on the replication driver type. If you use a Server Migration Tool (SMT) driver, you can set the following parameters:

*   bandwidth_limit: the maximum bandwidth for data transmission.
*   compress_level: the compression ratio of data to be transmitted.
*   checksum: specifies whether to enable checksum verification

For more information about the replication driver, see the response parameter `SourceServers.ReplicationDriver` of the [DescribeSourceServers](https://help.aliyun.com/document_detail/2402126.html) operation.', example='{"bandwidth_limit":0,"compress_level":1,"checksum":true}'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  scheduledStartTime?: string(name='ScheduledStartTime', description='The time when the migration job is executed. SMC starts the migration job at the specified time.

Specify the time in the ISO 8601 standard in the YYYY-MM-DDThh:mm:ssZ format. The time must be in UTC. For example, 2018-01-01T12:00:00Z indicates 20:00:00 on January 1, 2018 (UTC+8).

>  If ScheduledStartTime is left empty, SMC does not automatically start the migration job. In this case, you must call the [StartReplicationJob](https://help.aliyun.com/document_detail/121823.html) operation to start the migration job.', example='2019-06-04T13:35:00Z'),
  systemDiskPart?: [ 
    {
      block?: boolean(name='Block', description='Specifies whether to enable block replication for partition N in the destination system disk. Valid values:

*   true
*   false', example='true'),
      device?: string(name='Device', description='The ID of partition N in the destination system disk.

>  The partitions in the destination system disk are arranged in the same sequential order as those in the source system disk.', example='0_1'),
      sizeBytes?: long(name='SizeBytes', description='The size of partition N in the destination system disk. Unit: bytes. The default value is equal to the partition size of the source system disk.

>  The total size of all partitions in the destination system disk cannot exceed the size of the destination system disk.', example='254803968'),
    }
  ](name='SystemDiskPart', description='The partition information of the system disk.'),
  systemDiskSize?: int32(name='SystemDiskSize', description='The system disk size of the destination ECS instance. Unit: GiB. Valid values: 20 to 500.

>  The size of a destination data disk must be greater than the size of data in the source data disk. For example, if the source data disk has 500 GiB of storage space and 100 GiB of data, you must set this parameter to a value greater than 100.', example='50'),
  targetType?: string(name='TargetType', description='The type of destination to which the source server is migrated. You can modify the value only before the migration job starts. Valid values:

*   Image: After the migration job is complete, Server Migration Center (SMC) generates a destination Elastic Compute Service (ECS) image for the source server. You can use the image to create an ECS instance.
*   ContainerImage: After the migration job is complete, SMC generates a container image for the source server. You can use the container image in Container Registry.
*   TargetInstance: After the migration job is complete, SMC migrates the source server to the destination instance. If you set this parameter to TargetInstance, you must set the `InstanceId` parameter.

> 

*   The value of this parameter is not case-sensitive.

*   SMC does not allow you to migrate Windows servers or servers that run operating systems on the ARM architecture to Container Registry.', example='Image'),
  vSwitchId?: string(name='VSwitchId', description='The ID of the vSwitch in the VPC.', example='vsw-bp1ddbrxdlrcbim46****'),
  validTime?: string(name='ValidTime', description='The time when the migration job expires. You can schedule the migration job to expire 7 to 90 days after the job is created.

*   This parameter can be modified only if the migration job is in the Ready, Running, Stopped, InError, or Waiting state.
*   Specify the time in the ISO 8601 standard in the `YYYY-MM-DDThh:mm:ssZ` format. The time must be in UTC. For example, 2018-01-01T12:00:00Z indicates 20:00:00 on January 1, 2018 (UTC+8).
*   If you do not specify this parameter, the migration job does not expire.
*   After a migration job expires, the job state changes to Expired. SMC retains the migration job for seven days after the job expires. After the job is retained for seven days, SMC deletes the migration job.

By default, a migration job is valid for 30 days after it is created.', example='2019-06-04T13:35:00Z'),
  vpcId?: string(name='VpcId', description='The ID of the VPC for which an Express Connect circuit or VPN gateway is configured.', example='vpc-bp1vwnn14rqpyiczj****'),
}

model ModifyReplicationJobAttributeResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='1C488B66-B819-4D14-8711-C4EAAA13AC01'),
}

model ModifyReplicationJobAttributeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyReplicationJobAttributeResponseBody(name='body'),
}

/**
 * @summary Modifies the parameters of a migration job.
 *
 * @description ## Usage notes
 * Before you modify the parameters of a migration job, take note of the following information:
 * *   The `Name` and `Description` parameters can be modified during the lifecycle of the migration job.
 * *   The `Frequency` and `MaxNumberOfImageToKeep` parameters can be modified only before the migration job is executed or when the migration job is in the `Waiting` state.
 * *   Other parameters can be modified only before the migration job is executed.
 *
 * @param request ModifyReplicationJobAttributeRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyReplicationJobAttributeResponse
 */
async function modifyReplicationJobAttributeWithOptions(request: ModifyReplicationJobAttributeRequest, runtime: Util.RuntimeOptions): ModifyReplicationJobAttributeResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.containerNamespace)) {
    query['ContainerNamespace'] = request.containerNamespace;
  }
  if (!Util.isUnset(request.containerRepository)) {
    query['ContainerRepository'] = request.containerRepository;
  }
  if (!Util.isUnset(request.containerTag)) {
    query['ContainerTag'] = request.containerTag;
  }
  if (!Util.isUnset(request.dataDisk)) {
    query['DataDisk'] = request.dataDisk;
  }
  if (!Util.isUnset(request.description)) {
    query['Description'] = request.description;
  }
  if (!Util.isUnset(request.frequency)) {
    query['Frequency'] = request.frequency;
  }
  if (!Util.isUnset(request.imageName)) {
    query['ImageName'] = request.imageName;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.instanceRamRole)) {
    query['InstanceRamRole'] = request.instanceRamRole;
  }
  if (!Util.isUnset(request.instanceType)) {
    query['InstanceType'] = request.instanceType;
  }
  if (!Util.isUnset(request.jobId)) {
    query['JobId'] = request.jobId;
  }
  if (!Util.isUnset(request.launchTemplateId)) {
    query['LaunchTemplateId'] = request.launchTemplateId;
  }
  if (!Util.isUnset(request.launchTemplateVersion)) {
    query['LaunchTemplateVersion'] = request.launchTemplateVersion;
  }
  if (!Util.isUnset(request.maxNumberOfImageToKeep)) {
    query['MaxNumberOfImageToKeep'] = request.maxNumberOfImageToKeep;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.netMode)) {
    query['NetMode'] = request.netMode;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.replicationParameters)) {
    query['ReplicationParameters'] = request.replicationParameters;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.scheduledStartTime)) {
    query['ScheduledStartTime'] = request.scheduledStartTime;
  }
  if (!Util.isUnset(request.systemDiskPart)) {
    query['SystemDiskPart'] = request.systemDiskPart;
  }
  if (!Util.isUnset(request.systemDiskSize)) {
    query['SystemDiskSize'] = request.systemDiskSize;
  }
  if (!Util.isUnset(request.targetType)) {
    query['TargetType'] = request.targetType;
  }
  if (!Util.isUnset(request.vSwitchId)) {
    query['VSwitchId'] = request.vSwitchId;
  }
  if (!Util.isUnset(request.validTime)) {
    query['ValidTime'] = request.validTime;
  }
  if (!Util.isUnset(request.vpcId)) {
    query['VpcId'] = request.vpcId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyReplicationJobAttribute',
    version = '2019-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Modifies the parameters of a migration job.
 *
 * @description ## Usage notes
 * Before you modify the parameters of a migration job, take note of the following information:
 * *   The `Name` and `Description` parameters can be modified during the lifecycle of the migration job.
 * *   The `Frequency` and `MaxNumberOfImageToKeep` parameters can be modified only before the migration job is executed or when the migration job is in the `Waiting` state.
 * *   Other parameters can be modified only before the migration job is executed.
 *
 * @param request ModifyReplicationJobAttributeRequest
 * @return ModifyReplicationJobAttributeResponse
 */
async function modifyReplicationJobAttribute(request: ModifyReplicationJobAttributeRequest): ModifyReplicationJobAttributeResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyReplicationJobAttributeWithOptions(request, runtime);
}

model ModifySourceServerAttributeRequest {
  description?: string(name='Description', description='The description of the migration source. The description can be up to 256 characters in length and cannot start with `http://` or `https://`.', example='This is a source server.'),
  name?: string(name='Name', description='The name of the migration source. The name must be 2 to 128 characters in length. The name must start with a letter and cannot start with `http://` or `https://`. It can contain letters, digits, colons (:), underscores (_), and hyphens (-).', example='testSourceServerName'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  sourceId?: string(name='SourceId', description='The migration source ID.

This parameter is required.', example='s-bp17m1vi6x20c6g6****'),
}

model ModifySourceServerAttributeResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E'),
}

model ModifySourceServerAttributeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifySourceServerAttributeResponseBody(name='body'),
}

/**
 * @summary Modifies the name and description of a migration source.
 *
 * @description ## Usage notes
 * You can call this operation regardless of the status of the migration source.
 *
 * @param request ModifySourceServerAttributeRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifySourceServerAttributeResponse
 */
async function modifySourceServerAttributeWithOptions(request: ModifySourceServerAttributeRequest, runtime: Util.RuntimeOptions): ModifySourceServerAttributeResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.description)) {
    query['Description'] = request.description;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.sourceId)) {
    query['SourceId'] = request.sourceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifySourceServerAttribute',
    version = '2019-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Modifies the name and description of a migration source.
 *
 * @description ## Usage notes
 * You can call this operation regardless of the status of the migration source.
 *
 * @param request ModifySourceServerAttributeRequest
 * @return ModifySourceServerAttributeResponse
 */
async function modifySourceServerAttribute(request: ModifySourceServerAttributeRequest): ModifySourceServerAttributeResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifySourceServerAttributeWithOptions(request, runtime);
}

model ModifyWorkgroupAttributeRequest {
  description?: string(name='Description', description='The new description of the workgroup.

The description must be 2 to 128 characters in length. It must start with a letter but cannot start with `http://` or `https://`. It can contain letters, digits, colons (:), underscores (_), and hyphens (-).', example='test'),
  name?: string(name='Name', description='The new name of the workgroup. The name must be 2 to 128 characters in length. It must start with a letter but cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), and hyphens (-).', example='testMigrationTaskName'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  workgroupId?: string(name='WorkgroupId', description='The workgroup ID.

This parameter is required.', example='w-***'),
}

model ModifyWorkgroupAttributeResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='3E8B9ABB-289A-44E6-942D-8AA9E493****'),
}

model ModifyWorkgroupAttributeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyWorkgroupAttributeResponseBody(name='body'),
}

/**
 * @summary Modifies the name and description of a workgroup.
 *
 * @param request ModifyWorkgroupAttributeRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyWorkgroupAttributeResponse
 */
async function modifyWorkgroupAttributeWithOptions(request: ModifyWorkgroupAttributeRequest, runtime: Util.RuntimeOptions): ModifyWorkgroupAttributeResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.description)) {
    query['Description'] = request.description;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.workgroupId)) {
    query['WorkgroupId'] = request.workgroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyWorkgroupAttribute',
    version = '2019-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Modifies the name and description of a workgroup.
 *
 * @param request ModifyWorkgroupAttributeRequest
 * @return ModifyWorkgroupAttributeResponse
 */
async function modifyWorkgroupAttribute(request: ModifyWorkgroupAttributeRequest): ModifyWorkgroupAttributeResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyWorkgroupAttributeWithOptions(request, runtime);
}

model StartReplicationJobRequest {
  jobId?: string(name='JobId', description='The migration job ID.

This parameter is required.', example='j-bw526m1vi6x21q****'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
}

model StartReplicationJobResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E'),
}

model StartReplicationJobResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: StartReplicationJobResponseBody(name='body'),
}

/**
 * @summary Starts a migration job.
 *
 * @description ## Usage notes
 * This operation can only be used to start the migration jobs that are in the Ready, Stopped, or InError state.
 *
 * @param request StartReplicationJobRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return StartReplicationJobResponse
 */
async function startReplicationJobWithOptions(request: StartReplicationJobRequest, runtime: Util.RuntimeOptions): StartReplicationJobResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.jobId)) {
    query['JobId'] = request.jobId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'StartReplicationJob',
    version = '2019-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Starts a migration job.
 *
 * @description ## Usage notes
 * This operation can only be used to start the migration jobs that are in the Ready, Stopped, or InError state.
 *
 * @param request StartReplicationJobRequest
 * @return StartReplicationJobResponse
 */
async function startReplicationJob(request: StartReplicationJobRequest): StartReplicationJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return startReplicationJobWithOptions(request, runtime);
}

model StopReplicationJobRequest {
  jobId?: string(name='JobId', description='The migration job ID.

This parameter is required.', example='j-bw526m1vi6x21qh****'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
}

model StopReplicationJobResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E'),
}

model StopReplicationJobResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: StopReplicationJobResponseBody(name='body'),
}

/**
 * @summary Pauses a migration job.
 *
 * @description ## Usage notes
 * You can call this operation to pause only a migration job whose primary status is Running and business status is Syncing.
 *
 * @param request StopReplicationJobRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return StopReplicationJobResponse
 */
async function stopReplicationJobWithOptions(request: StopReplicationJobRequest, runtime: Util.RuntimeOptions): StopReplicationJobResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.jobId)) {
    query['JobId'] = request.jobId;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'StopReplicationJob',
    version = '2019-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Pauses a migration job.
 *
 * @description ## Usage notes
 * You can call this operation to pause only a migration job whose primary status is Running and business status is Syncing.
 *
 * @param request StopReplicationJobRequest
 * @return StopReplicationJobResponse
 */
async function stopReplicationJob(request: StopReplicationJobRequest): StopReplicationJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return stopReplicationJobWithOptions(request, runtime);
}

model TagResourcesRequest {
  ownerId?: long(name='OwnerId'),
  resourceId?: [ string ](name='ResourceId', description='The IDs of N SMC resources. SMC resources include migration sources and jobs. Valid values of N: 1 to 50.

This parameter is required.', example='s-bw526m1vi6x20c6g****'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceType?: string(name='ResourceType', description='The type of the SMC resource. Valid values:

*   sourceserver: migration source.
*   replicationjob: migration job.

This parameter is required.', example='sourceserver'),
  tag?: [ 
    {
      key?: string(name='Key', description='The key of tag N to be added to the SMC resource. Valid values of N: 1 to 20.

The tag key cannot be an empty string. It can be up to 64 characters in length and cannot start with acs: or aliyun. It cannot contain http:// or https://.', example='TestKey'),
      value?: string(name='Value', description='The value of tag N to be added to the SMC resource. Valid values of N: 1 to 20.

The tag value can be an empty string. It can be up to 64 characters in length and cannot contain http:// or https://.', example='TestValue'),
    }
  ](name='Tag', description='The tags.

This parameter is required.'),
}

model TagResourcesResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='3E8B9ABB-289A-44E6-942D-8AA9E493****'),
}

model TagResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: TagResourcesResponseBody(name='body'),
}

/**
 * @summary Creates tags and adds them to Server Migration Center (SMC) resources. The SMC resources include migration sources and jobs.
 *
 * @description ## Usage notes
 * Up to 20 tags can be added to each SMC resource.
 * Before you add tags to an SMC resource, Alibaba Cloud checks the number of the tags that have been added to the resource. If the maximum number is reached, an error message is returned.
 *
 * @param request TagResourcesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return TagResourcesResponse
 */
async function tagResourcesWithOptions(request: TagResourcesRequest, runtime: Util.RuntimeOptions): TagResourcesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  if (!Util.isUnset(request.tag)) {
    query['Tag'] = request.tag;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'TagResources',
    version = '2019-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Creates tags and adds them to Server Migration Center (SMC) resources. The SMC resources include migration sources and jobs.
 *
 * @description ## Usage notes
 * Up to 20 tags can be added to each SMC resource.
 * Before you add tags to an SMC resource, Alibaba Cloud checks the number of the tags that have been added to the resource. If the maximum number is reached, an error message is returned.
 *
 * @param request TagResourcesRequest
 * @return TagResourcesResponse
 */
async function tagResources(request: TagResourcesRequest): TagResourcesResponse {
  var runtime = new Util.RuntimeOptions{};
  return tagResourcesWithOptions(request, runtime);
}

model UntagResourcesRequest {
  all?: boolean(name='All', description='Specifies whether to remove all tags that are added to the specified SMC resource. This parameter is valid only if you do not set `TagKey.N`. Valid values:

*   true: removes all tags that are added to the specified SMC resource. If no tags are added to the specified SMC resource, no operation is performed.
*   false: does not remove tags that are added to the specified SMC resource.

Default value: false.', example='false'),
  ownerId?: long(name='OwnerId'),
  resourceId?: [ string ](name='ResourceId', description='The IDs of N SMC resources. SMC resources include migration sources and jobs. Valid values of N: 1 to 50.

This parameter is required.', example='s-bw526m1vi6x20c6g****'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceType?: string(name='ResourceType', description='The type of the SMC resource. Valid values:

*   sourceserver: migration source.
*   replicationjob: migration job.

This parameter is required.', example='sourceserver'),
  tagKey?: [ string ](name='TagKey', description='The key of tag N that is added to the SMC resource. Tag keys are case-sensitive. Valid values of N: 1 to 20.', example='TestKey'),
}

model UntagResourcesResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='2D69A58F-345C-4FDE-88E4-BF518948****'),
}

model UntagResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UntagResourcesResponseBody(name='body'),
}

/**
 * @summary Removes tags that are added to Server Migration Center (SMC) resources. The SMC resources include migration sources and jobs.
 *
 * @description You can call this operation to remove tags that are added to one or more SMC resources and delete the tags if the tags are no longer used.
 *
 * @param request UntagResourcesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UntagResourcesResponse
 */
async function untagResourcesWithOptions(request: UntagResourcesRequest, runtime: Util.RuntimeOptions): UntagResourcesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.all)) {
    query['All'] = request.all;
  }
  if (!Util.isUnset(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!Util.isUnset(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  if (!Util.isUnset(request.tagKey)) {
    query['TagKey'] = request.tagKey;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UntagResources',
    version = '2019-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Removes tags that are added to Server Migration Center (SMC) resources. The SMC resources include migration sources and jobs.
 *
 * @description You can call this operation to remove tags that are added to one or more SMC resources and delete the tags if the tags are no longer used.
 *
 * @param request UntagResourcesRequest
 * @return UntagResourcesResponse
 */
async function untagResources(request: UntagResourcesRequest): UntagResourcesResponse {
  var runtime = new Util.RuntimeOptions{};
  return untagResourcesWithOptions(request, runtime);
}

